« first day (1471 days earlier)      last day (3470 days later) » 
00:00 - 18:0018:00 - 00:00

6:00 PM
Of Spritesheeet class?
 
You're snipping out code out of context and don't add the relevat codes involved to that code. How are we supposed to help you solve a puzzle when you only hand us a few pieces? ;)
 
Well, You're supposed to create your own pieces
Joking haha, sorry. I'm not good at asking Programming questions
 
It's ok.
 
Do you want the constructor of Game.class or SpriteSheet?
 
the parameter to the constructor is null, and that code is not shown (game.getSpriteSheet())
 
6:01 PM
I'm no pro either, but the issue tracks back to that the image you're grabbing don't exist
 
This is the getSpriteSheet method
public BufferedImage getSpriteSheet(){ return spriteSheet; }
Sorry for the long wait, I checked this method and I have spriteSheet variable
in the public void init()
spriteSheet = loader.loadImage("/Sprite_Sheet.png");
 
and where that is set?
 
Although it seems like I haven't declared it
So I'll check for that now
Oh, nvm I have
private BufferedImage spriteSheet = null;
 
ok, then loadImage() fails, assuming you remember to call init()
 
although it's set to null, It's still initiated to the image, so yeah. You're right, I'll check now
Hmm, any idea why loadImage fails?
(And I forgot to add, I did call init() in the main constructor)
 
6:06 PM
Do this; make a linear pastie where all the methods and instances are from top to bottom in the order they are called upon.
 
(as a side note, it's often a good idea to fail fast; ie. in this case you could throw an exception as soon as you have got a null from loadImage())
 
public BufferedImage grabImage(int column, int row, int width, int height){
        System.out.println("img is " + image); //<<<< How I tested for null.. May not be the best way, but image said to be null

        BufferedImage img = image.getSubimage((column * 32) - 32, (row * 32) - 32, width, height);

        return img;
That one, where does it get the image from?
 
the image, variable? or the image itself as the png?
package com.game.main;

import java.awt.image.BufferedImage;

public class SpriteSheet {

private BufferedImage image;

public SpriteSheet(BufferedImage image){
this.image = image;
System.out.println("img is " + this.image); // <<<<<<<<< THIS ONE SHOWS "img is nullException in thread "Thread-0" " in the console
}

public BufferedImage grabImage(int column, int row, int width, int height){
System.out.println("img is " + image); //<<<< How I tested for null.. May not be the best way, but image said to be null
And I call SpriteSheet in the textures class
ss = new SpriteSheet(game.getSpriteSheet());
 
Guys do you know any tool to design a plan for OOP structure? Some diagram tool or something that can be helpful?
 
Anything that you might need, like a class or something should be in the question itself :)
 
6:11 PM
As far as I can see, the null comes from loader.loadImage("/Sprite_Sheet.png");
 
Anyone know how to set custom timeout on a socket object?
 
@BenBeri I use pen and paper :P
 
@Gemtastic Well I have to show it to others and my handwriting is shit haha
 
@kiheru I'm never using .connect, I'm only trying to Socket s = new Socket(SERVER_ADDRESS, TCP_SERVER_PORT which hangs my code too long
 
6:16 PM
Doodle it down on paper first, then make a clean version in word, illustrate with paint if you have to?
 
@robobenklein Sockets don't have timeouts, operations do, as people have stated in answers to that questions. Use the default constructor, and then specify the timeout on connect.
 
@kiheru Ah ok, thanks.
 
fge
Uhwell, there may be a way to timeout a socket construction if you use the constructors with host names as arguments (hint: name resolution service timeout)
 
That's why I suggest using the parameterless constructor. Better control of the timeouts
(Actually I know nothing at all about socket programming. But I can read docs :-P)
 
6:44 PM
hi guys
may i ask a question?
 
@OiRc You can always ask, answers aren't guaranteed, but seeing as FGE is here, you might have a shot :)
 
ok
if i have a map of objects and each threads can go inside each buckets concurrently,resulting a block like syncrhonized(values.get(ObjectToLock)){
int sum = 0;
for(int i = 0; i< new Random().nextInt(1000)+2; i++)
sum+=i;
for(int i = 0; i < 10; i++)
for( int j = 0; j < 10 ; j++)
System.out.println(*);
return sum;
} i want to understand why the first for of the sum remains "atomic" for each threads and not the print of the * matrix, can someone pro
 
fge
@OiRc how do you ever print a matrix here since you .println()?
 
Sorry for asking alot of stuff, but how would I fix the problem of the image loaded in being null?
0
Q: Why this doesn't appear to be initialized

BiblyDooI have a typical NullPointerException: Exception in thread "Thread-0" java.lang.NullPointerException at com.game.main.SpriteSheet.grabImage(SpriteSheet.java:17) at com.game.main.Textures.getTextures(Textures.java:30) at com.game.main.Textures.<init>(Textures.java:21) at com.game.main.Game.init(...

 
7:16 PM
May I ask you a question?
 
You just did, your one question is used up. Next time, just ask the question!
;P
 
okay, well..
I'm getting files from a path using: all = new File(path).listFiles();
How can I make it so that it doesen't count folders?
 
You want it to list paths but not count them?
 
@Gemtastic What kind of attitude is that?
 
It's not an attitude, it's an honest question
 
fge
7:27 PM
@minisurma Files.newDirectoryStream(baseDir, Files::isDirectory)
(Java 8)
Ah, wait, you want to filter them out
So the second argument would be `(path) -> !Files.isDirectory(path)
@minisurma more generally, since Java 7 you should drop File altogether
It is the worst part of Java after Serializable
 
I thought clone() was worse
 
7:49 PM
Anyone have TCP experience here?
 
8:24 PM
@Gemtastic Sorry, it's been one of those days. I wasn't commenting about your question, but your "You just did, your one question is used up."
You sound like me! :P
 
9:04 PM
@Joe'sMorgue We just had one person in here ask if it was ok to ask, and told to just shoot, and then another one. i just couldn't help myself poking fun at that :P
 
fge
9:40 PM
AssertJ rocks
 
 
1 hour later…
10:45 PM
sooo
'sup?
 
11:15 PM
mhm
Physics SE is pretty hostile. :3
 
oh?
 
I answered a question, got slapped with a downvote, and had my post closed all within 10 min.
Something to do with not answering hw questions...
 
hw?
 
Homework question
 
ah
 
11:17 PM
I provided a complete answer. Apparently that is frowned upon.
Understandably, after spending 10 min I am distressed. :3
 
What was your question?
 
Oh it wasn't my question, but I answered the OP/
-2
Q: Free Fall homework help

ScribblenauticalSo this is the word problem: A knight sits on a castle wall during a siege. To while away the time, he notes that boulders catapulted from below land on the top of his wall with a vertical velocity of 9.8 m/s. If he is 43 meters above the catapult, what is the initial velocity of the boulders? T...

I mean it was a pretty simple question, but I was kind of surprised that Physics SE is pretty antagonistic towards people who ask and answer questions related to homework.
/rant
 
You haven't met Uni on his OffT hunts ;P
 
I remember Uni showed me all his downvotes lol.
 
'Well, the reason is pretty simple, they want heavier stuff related to reality, not school at that site. Even if your answer is right, it's off topic
 
11:21 PM
meh
 
"Don't ask about...

"Do my homework"-type physics questions"
That apparently included your question
My first question on this site got bashed so hard I don't really wanna ask anything ever again :P
 
LOL
Yea, then why even put a homework-and-exercises tag?
:(
 
Good question. Maybe some dweeb added it?
 
You mean the moderator who deleted my answer? xD
 
Well, it is how it is. They are allergic to homework questions there
 
11:26 PM
It seems that way.
 
Info on the tag though: Please READ THE GUIDANCE IN META before asking homework-like questions.
So yeah, they seem pretty allergic to homework questions :/
 
11:47 PM
Happy late halloween!
 
Hey Uni.
 
Halloween's so over people even had to remove their haloweenatars
<--- thus
 
@Jun-GooKwak I think someone flagged the question as very low quality, which put both the question and your post into a high priority mod review queue. Seeing the thread is garbage anyway, they just nuked it. Physics doesn't preserve good answers to bad questions.
Some sites like cs.SE has less strict quality controls.
 
Does any site preserve good answers to bad questions?
 
Yes, Stack Overflow.
 
11:52 PM
hmm
btw, good morning Uni
 
Those old of topic questions asked before the scope was clearly defined, they're locked instead.
Morning!
 
Hi! I have a question about TCP Sockets.
If anyone is on
 
Continue?
 
So, I have a TCP listener, I also want it to respond to the socket but it keeps saying that the pipe is closed or something like that. So I want to create a new socket to respond to it
Here is my current source: http://pastebin.com/REW7MSFn

connectionSocket.getOutputStream() is being closed before I can ever respond to it.
 
What was the exact message?
 
11:56 PM
I will get the message for you in a second.
Ok, one second. It's not showing up now. Either it fixed over the hours of me not being home
Or something else
Ok, lol, so it fixed over the hours of me not being home. But there is another problem.
 
Oh?
 
Let me actually try something else.
I think it just stopped listening
 
00:00 - 18:0018:00 - 00:00

« first day (1471 days earlier)      last day (3470 days later) »