« first day (2130 days earlier)      last day (2730 days later) » 

12:01 AM
Also, can someone describe to me what .class does in Java? it's kinda hard to google since google ignores .
 
@Downgoat its the class object
 
.class is the compiled java code
 
so can i do like GraphicObject[] = { Goat, Sheep }; where Goat and Sheep inherit from GraphicObject
i dont want to do Class[] = { Goat.class, Sheep.class }; since that can be ambiguous
 
0
Q: Validate a PNG file

SoniEx2Write a program that can validate a PNG file. Your program should follow the PNG spec and must validate the PNG signature and the 4 critical chunks: IHDR, IDAT, PLTE and IEND. Your program must not validate the contents of ancillary chunks, except for their CRC checksums. Your program must valid...

 
:( new (Foo.class)(args); bork
 
12:06 AM
@Downgoat Why would you expect that to work :P
 
because idk java
 
Foo.class.newInstance() if you must
 
not sure why they are primitives, and classes for those primitives when both can't be used interchangibly but yet are named the same
 
But I encourage you to reconsider what you are doing
@Downgoat They aren't primatives
 
here is code:
   public void paintComponent(Graphics g)
   {
      super.paintComponent(g);
      Graphics2D g2 = (Graphics2D) g;

      Class[] items = {
          Turkey.class,
          Plate.class
      };

      GraphicItem curItem;
      for (int i = 0; i < items.length; i++) {
          curItem = new (items[i])();
          curItem.draw(g2);
      }
   }
i mean this is how i would do in JS
 
12:10 AM
what the heck
why do you even need a loop for that
 
well that's for now but i'll be wanting to make 20x or so copies of each class
 
@Downgoat well I think you can use for-each loop in the later versions of java
@Downgoat also why need to store classes?
 
:O TURKEY WORKED
 
the whole good part about java is polymorphism
 
SUCH A BEAUTIFUL TURKEY
 
12:22 AM
you have to do:
This_is_my_base_class_or_interface[] items = {Trukey(), Plate()};
for (This_is_my_base_class_or_interface item:items) {
    item.draw(g2);
}
that's it
polymorphism
@Downgoat ^
 
but what is i want to make 100x turkeys
 
Trukey trukey = new Trukey();
trukey.golbeGolbe();
 
> Trukey
 
@Downgoat you don't understand
I'm not saying not to make the loop
I'm saying storing Class objects in arrays and then instantiating them defeats the entire point of polymorphism.
I hate java, and even I find that code frightning
you're supposed to store all the instances in the array, made possible by polymorphism
like GraphicItem[] items = {Turkey(), Plate(), classnum3(), ..., classnum100};
and then do your loop with the drawing
 
ok i fix
@Maltysen ahhhh ok
I understand
that was silly mistake i did
 
12:30 AM
@Downgoat what is this for btw?
 
HW
i gotta make a picture with weird java graphic api
wow java is slow O_o
it take like a second to run basic turkey program
 
Reflection is super slow
And anything involving graphics has startup time
 
i stoped using reflection stuf
Wat, why is scaling so complex in java
Polygon#scale must of been very hard to implement?
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
	at DrawableItem.draw(DrawableItem.java:21)
>_>
does this mean infinite recursion bork?
 
12:51 AM
Class[] items = {
Turkey.class,
Plate.class
}; wont work. You need to create instances of Turkey and Plate for java
 
Question: is there better way to do:
abstract public void draw(Graphics2D g2, int x, int y, double scale);

public void draw(Graphics2D g2, int x, int y) {
    this.draw(g2, this.dx + x, this.dx + y, 1);
}

public void draw(Graphics2D g2) {
    this.draw(g2, this.dx, this.dy, 1);
}
therse lots of repeating here
 
what do you mean?
@Downgoat dude its called Java2D. Its not weird, its cool.
 
:/
it doesnt support hidpi display tho
:O I GOT HIDPI TURKEY
@AshwinGupta is there nice way to rotate Polygon w/ Graphics2D around origin
SO gives scary long answer
surely this should be simple three-line thing like JS
pls halp i am doing something wrong:
public void draw(Graphics2D g2, double x, double y, double scale, int rotation) {
    this.paint(g2, scale * this.dx + x, scale * this.dy + y, scale, rotation);
}

public void draw(Graphics2D g2, double x, double y, double scale) {
    this.paint(g2, scale * this.dx + x, scale * this.dy + y, scale);
}

public void draw(Graphics2D g2, double x, double y) {
    this.paint(g2, this.dx + x, this.dx + y, 1);
}

public void draw(Graphics2D g2) {
    this.paint(g2, this.dx, this.dy, 1);
}
 
1:24 AM
Just use transforms
or take the average of the points
I'd show you but I'm at diner on a phone
If you've done any OpenGL imagine moving stuff with matrix math.
But use the java AffineTransform
 
1:39 AM
@flawr how does one prove that the inverse fourier transform of 1 gives you the delta function?
I can understand why through intuition of all waves being pi out of phase with another wave at all points except 0
but trying the indefinite integral gave me a limit that doesn't exist
 
@Downgoat ???
 
1 hour ago, by Downgoat
user image
 
What program even is that??
 
CS HW
don't ask
 
@Downgoat Challenge: Golf all the easy CS HWs.
Your teacher will be like "wtf how is dis java???"
@Downgoat How about you write it in Kotlin, compile it to Java bytecode, and then decompile the Java bytecode into Java?
 
1:50 AM
That sounds like a terrible idea
 
@quartata Vihan CS Homework, confused on java
 
I'm aware
 
@quartata People do it
 
@noɥʇʎPʎzɐɹC Those people get bad grades
 
Or Jython. Or use a JS interpreter written in Java
 
1:51 AM
Decompiled code does not look good, although I'll admit Fernflower is a very good decompiler
 
@quartata And the people who golf the homework?
 
@noɥʇʎPʎzɐɹC Get even worse grades! :P
In general the better an idea the teacher has of what the hell is going on the better the grade
Even if the code is not entirely right
@Downgoat please update chatexchange-sourcepython and the relay and add two plugins we mentioned in the tf room
We're desperate at this point; the relay is kind of unstable right now
 
@quartata >_> yeah, will do but really gotta finish this
do my Java HW and it'll be done quicker :) :P
question: how to do:
wait nvm
quesiton: how to get static variable of current class?
I basically have:
class Pumpkin {
    public static final Color[] palette = { ... }:
    public Pumpkin() {
        super( Pumpkin.palette );
    }
}
but I want to work on subclass of Pumpkin without updating constructor
 
Use a getter
 
elaborate?
 
1:58 AM
And override in the subclasses
 
but i won't be able to access it in the super call
 
super(getPalette())
 
Bah, Java? Write a factory
 
Oh I see what you mean. Der.
 
@HWalters O_O
why do they teach java it is just painful ;_;
okay i got idea
 
2:01 AM
Just don't make palette static
Set the underlying field though don't shadow
 
FFS we have to javadoc everything
 
javacado?
oh doc
 
> free javacado
 
joxygen
 
doxygen actually supports java
 
2:10 AM
.__.
 
?
 
why is it called doxygen and not jdoxygen
or public static void main(String[] args) java.awt.geom.jdoxygen :P
 
Because it was made for C?
 
oh
 
I take it you're using java.awt.geom? I honestly pity you
 
2:12 AM
How would one describe the blue vs gray vote buttons? The blue ones are pressed? active?
 
The largest mistake I ever made in my life was using Polygon
OK that was overdramatized. But.
Area is a little better but not by much -- it's missing things Polygon has
 
what is wrong with polygon
its only as bad as the rest of java
 
2:39 AM
java is truly beautiful language
 
wat
 
@Downgoat are the green things avocados viewed from above?
 
those are green pumpkins :|
@DJMcMayhem brb titling image "wat"
im using very random XKCD RNG
 
yes
 
2:50 AM
Fun fact: Arbitrage is a surprisingly effective strategy in Minecraft servers' economies
But even more effective is the million-dollars-appearing-out-of-thin-air-into-your-pocket strategy
 
Fun fact: If you use all non-letter printable ASCII chars in order as a CJam program, then delete one char at a time until you stop getting errors, the resulting program prints all ASCII chars from NUL to ( in order plus a backslash
 
Never invite Java to your Thanksgiving party
 
What is that supposed to be?
I see pumpkins and corn
 
pumpkin corn and turkey
supposed to be organized in nice table but java had to happen
java graphics library is exceptionally difficult to use
 
‌

[1 3 2][1 3 2]
(all chars from \x00 to \x1F) !"#$%&'(1011121314151617181920
3.141592653589793 000-1
 
3:07 AM
aww yisss
 
beautiful
quality squash
 
tanks :3
 
much more lovely now
 
looks decent except damn turkey dont wanna align well ;_;
 
3:22 AM
@Downgoat I'm really curious how you manage to blame Java for that mess :P
 
java alignment is weird
 
What layout manager are you using?
 
layout what
i am just doing maths
 
@Downgoat If the math comes out wrong, it's not Java's fault >_>
 
3:23 AM
I'd recommend GridBag
or just Grid maybe
 
@Geobits are you saying goat canot math ಠ_ಠ
 
Yes.
 
if you are, it is true however ;_;
 
Or rather that the goat messed up this time. Not necessarily can't ever math :)
But yeah, a GridLayout would work here, but you'll probably complain about the overhead or something ;)
 
im curious how i bork things without touching it
okay i think i give up
hm.. how else can i organize the objects in asthetically pleasing way...
>______> I forgot to multiple the position by scale factor
huh now it works perfectly >_>
this took me 4 hours O_O
 
3:45 AM
@Downgoat college or high school class?
Also, nice drawings. Pumpkins, corn, green squash, and what is the last thing?
 
@AshwinGupta Turkey
 
oh
thats not a vegetable.
each fruit is a seperate component?
or all on one JPanel?
 
@AshwinGupta it is AP CS so 1st semester of a college CS class but in HS
@AshwinGupta each fruit is seperate class
 
Oh also @Downgoat I think you set up me in the JSON wrong
 
^ Project UML
 
3:47 AM
@Downgoat Did you actually make that?
 
yes
 
@Downgoat no IK that but is each its own Component or all drawn on one JPanel
 
They actually make you make UML diagrams for every exercise?
 
@Downgoat nvm got it.
 
@quartata >_> well program usually has thing which generates them but on most handwritten excerices we have to draw them
 
3:48 AM
Oh it looked hand made to me
Because of the arrows to GraphicItem
 
goat, did you manually specify each of those shapes using polygons and trial and error with java2d? Or did you draw it out first in an art program and export the coords.
 
I'm guessing the exercise specified them.
 
@quartata hopefully. They aren't just pngs are they?
 
I'm somewhat impressed they're teaching you Java 2D at all
 
Why?
Java2D is really straight forward.
Super explicit.
 
3:49 AM
@AshwinGupta i basically drew in adobe illustrator and exported as SVG. SVGPolygon is a class which takes an SVG polygon and converts it to a Java POlygon
 
It isn't really something I'd imagine being covered in first-semester Java
 
@quartata they don't. They just expect us to google java api
 
Anonymous
UML-generation tools are neat for OOP work - can't live without them
 
@Downgoat oh okay smart. Way smarter then manually specifying coords.
 
like it is ltierally in the textbook
 
3:50 AM
@Downgoat ??
@Mego Oh yes, I know. I assumed it was hand made at first
 
> Google "Java Graphics API" for more information
 
OK then
 
@Downgoat lol. I'm sure someone has written a really easy one for AP comp-sci students
 
Anonymous
It's 2016 - why would anyone do anything by hand? :P
 
most people's are probably just gonna be multi-colored boxes but if yours is good enoguh so you get extra credit on test, which i need so i can hit an A+ by end of semester
@AshwinGupta if you don't mind, what grade are you in rn?
 
3:51 AM
@Mego learning. I leaned some basic OpenGL even though I had stuff like Unity available to me from the start.
@Downgoat freshman
 
The exercise was literally just "draw something" or what
 
@AshwinGupta your GH bio is out of date in that case
 
@Downgoat nice
 
@quartata lemme link you to spec
 
@Downgoat what does it say?
oh yeah
ok
ty
@Downgoat one thing, why not just export as a PNG and use drawImage?
 
3:54 AM
woah, google captcha has gotten really complex
 
@Downgoat what is it now? I swear they are always changing those things
 
@AshwinGupta GODDAMMIT
 
hahahaha
 
@AshwinGupta you have to outline certain features of an image
 
what?
 
3:55 AM
I was kind of wondering why you were bothering with SVGs
 
@Downgoat when clicked you mean?
 
I WASTED LIKE FOUR F*CKING HOURS ;_____;
 
This is probably more impressive I suppose
 
@Downgoat what?
@quartata extra credit remember :P
 
You don't even need to use Java2D in that case, you can just use JLabel and ImageIcon
 
3:56 AM
@quartata yeah but you don't have as much flexibility for other effects
 
@Downgoat soooo while you're lamenting your life choices can you fix all of our tf2 stuff? :P
 
@Downgoat if its any consolation, at least you learned how to use the SVG functionality in java2d. That could be very useful down the road.
 
seriously flash
 
>_> only PDF host i could find that worked
 
3:58 AM
@quartata preach.
flash needs to die quicker, I hate going on a flash website.
 
@Downgoat Isn't this asking to specifically output the card they showed
 
I thought you were making a game of some sort, like a Candy-Crush thing
Greeting card is more boring
thats why i asked if each image was a seperate swing component.
 
@quartata no thats example
 
Either way that's terrible and I can't believe they specified for you to "have fun"
 
@quartata ha IKR, with Java 2D make a static greeting card.
 
4:00 AM
@Downgoat In that case I must say your card is rather stylish
 
you could make a better card in MS PP
 
:D thank you
 
@quartata yeah actually its very nice
 
At least relatively
 
Though there's no greeting :|
 
4:01 AM
tongue in cheek solution- make an epic greeting card in graphics program like PS, export it as image, use java2d draw image and fill the entire JFrame with your card image.
actually you should turn that in along with your really card, you might get extra credit for being clever.
xD
 
@AshwinGupta haha totally
 
lol
ok bye, I gtg, good luck finishing that project. Also, when you are ready for text: FontMetrics is your friend.
 
@AshwinGupta .o/ bai, and thanks for halp
 
np, didn't really help much, but I'll take credit for it.
 
4:14 AM
@quartata ;_; wait wat
 
@Downgoat see tf room for comprehensive todo list
@Downgoat :P
I mean it's nice but I'm not sure it's really the Louvre's style
 
@quartata Louvre's style?
never heard that before ._.
I mean the Louvre's style is pretty much triangles, lots of triangles
 
Anonymous
4:32 AM
Have we really managed to find all of the decision problems on PPCG and tag them?
 
Some are false positives, but I'd be surprised if all were
 
@Geobits 10/10 solid search
 
5:04 AM
@betseg only good side of this is that I saw sunrise first time in my life :D
 
wat
Who wants to play a game of multiplayer Civ 2? :D
 
Anonymous
@Geobits I'll start adding those to the meta post
 
5:19 AM
0
Q: where the error to get a right output

ibeer Abeer src=drawLine> { function drawline(length,color,indent); drawline(5,red,10); } { function drawArrow(length,color,indent); drawArrow(5,blue,10 +''); } { function drawRectangle(length,color,indent); drawRectangle(5,red,10); } var year,month,day,birthday,today,age,birthYear,currentYear,count...

 
wat
twf that title gore
 
wat
5:34 AM
TFW**
tfw this happens
 
5:50 AM
110/11=1+1+0
^ true in binary
 
6:37 AM
@Geobits consider also the spelling "falsey"
 
7:18 AM
 
 
1 hour later…
8:24 AM
Hello?
Yay, 2k rep!
 
Yay
 
Also I revamped the syntax for Ceebstyle (the language)
foo [
  color #fff
  font_size 20
]
section {
  [foo]
  "This is a
   multi-lined text."
  section {
    [
      font_type "Comic Sans"
    ]
    header 2 "Stop."
  }
}
This looks much cleaner IMO
What do you think @betseg?
 
Yup looks better
 
You can understand what's going on, right?
 
Yes
 
8:36 AM
So basically square brackets are styles and curly brackets replace parens
 
@Qwerp-Derp you know brainfuck?
 
Of course
Who doesn't know BF on PPCG?
 
Why ,[>,][<]>[.>] doesn't work
 
You have to do this:
,[>,]<[<]>[.>]
Cause you end up on a 0 when input is empty
so you have to go back to the last entered byte
 
Ah k
EOF is probably 0x00, not -1
I'm trying to do line comment thing in pbrain (brainfuck derivative, basically procedural brainfuck)
 
8:52 AM
I give up :(
 
9:24 AM
@Maltysen (There are several ways.) First of all, are you talking about the fourier transform or the fourier series? Then, what definition of the delta function are you using?
 
10:15 AM
0
Q: Witness My Challenge (Tetris Puzzle)

Bobas_PettIntroduction In the game The Witness there is a group of puzzles that involve drawing a Tetris piece with your line while making sure that the symbol for the Tetris piece your currently drawing stays contained within the shape you've drawn. For the image above the drawing works because the ...

 
Interesting article, maybe gives rise to a nice golf challenge? arxiv.org/abs/1605.03546
 
10:35 AM
Is it me or is Github incredibly slow?
 
Working fine here
 
who downvotes posts in the formatting sandbox?!
 
People who think that the question isn't good enough?
 
foo [
  colour #fff
  font_size 20
]
other [
  font "Comic Sans"
]
text [
  font "Candara"
]
section {
  [foo, other]
  text "
    This is a multi-lined
    text.
  "
  section {
    [other]
    header 2 "Please stop."
  }
}
Wait formatting sandbox?
What
Also ^^^ more complex(?) version of Ceebstyle code
 
11:30 AM
Hi
 
> Comic Sans
 
 
1 hour later…
12:36 PM
0
A: Sandbox for Proposed Challenges

ZgarbRailroad switch network code-golf path-finding graph-theory Introduction Suppose we have a network of railroads. Each junction in the network is controlled by a switch, which determines whether an incoming train turns left or right. The switches are configured so that each time a train passe...

 
12:59 PM
PSA: if you can't see imgur images at school, use imgh.us as a proxy
 
1:15 PM
0
A: Sandbox for Proposed Challenges

AngsCollapse ascii-art into a pile Challenge Given a rectangular grid of printable ascii characters, write a function or program that collapses into a pile. The rules: The output has the same dimensions and characters as the input. A non-space character at (row a,column b) can't have a space c...

 
@MartinEnder Why did you add to this challenge?. Obviously it has to do with triangles but the definition of the tag is: “This challenge is intended to be solved by using, manipulating, or creating shapes or other geometric structures” which I don't think fits the challenge at all.
 
Hm, then maybe we should rework that tag a bit? Since the challenge clearly has to do with geometry, I think the tag should apply (as the purpose of tags is to allow people to find challenges surrounding a certain topic of interest). Whether the challenge is actually about manipulating geometric shapes or just calculating their properties shouldn't matter.
 
I think this tag doesn't really fit to that challenge. We are just evaluating a formula which of course has it's origin in something geometric, but for the challenge you really don't need to know anything about triangles. The challenge doesn't even explain what the aspect ratio of a triangle is, except giving a formula.
 
The only things it says about what the aspect ratio is is: “The closer to equilaterality a triangle is, the closer to 1 its aspect ratio is”
So it's a “measure” of how equilateral a triangle is
 
1:31 PM
jelly.tryitonline.net/… lol floating numbers
 
I am going to implement a serious language for my project. which one is better : pascal-like or basic-like syntax?
 
Neither is better. Which one do you like?
 
Jelly-like is the best
 
@GLASSIC C-like syntax
 
1:47 PM
A practical C++ talk: Making logic errors compile-time errors with types: youtube.com/watch?v=ojZbFIQSdl8
 
2-minute old Numberphile video! *click*
 
I got the notification, I want to watch, but I'm on a bus and I don't have my headphones :(
You understood? :D
 
yeah XD it is the best help i can do for my colleague
 
Drawing a heptatriagonal tiling by hand on camera? Brave man. :P
 
@El'endiaStarman link for the lazy?
 
This challenge has no question type/winning criterion tag. Does it need one, and which one should it be?
 
@Zgarb That's a lot of votes for no answer!
 
seems fitting
 
1:58 PM
@Fatalize Yeah, I'll add that.
 
I just realized that the project I'm working on has been actively developed for over 34 years.
 

« first day (2130 days earlier)      last day (2730 days later) »