« first day (1420 days earlier)      last day (3520 days later) » 

2:00 PM
Guys i have a jsp issue... anyone would help please?
i uploaded a question and cant find hlep :(
 
aha
 
@IbrahimNadir Ask.
 
0
Q: Form parameters not passing but File in the same form processed

Ibrahim NadirI have a webform on JSP which has several string values and a file to uploaded to the server through a servlet. It is strange to see that i'm able to upload the file on to the server but not able to get the values in the servlet using request.getParameter("someString") Can anyone please find out ...

thats my question
 
The type List is not generic; it cannot be parameterized with arguments <GameEventListener>
Should have been ArrayList?
private final List<GameEventListener> listeners = new ArrayList<GameEventListener>();
 
import java.util.List, instead of an awt List
 
2:02 PM
@IbrahimNadir why File storeFile = new File(filePath); is unused?
and what's up with // TODO Auto-generated catch block?
 
i will have to look into it again
 
okay
 
but it uploads the file perfectly!
 
Can GamePiece be ImageIcon?
 
it could be. It's not ideal, but you don't have the time to write perfect code
 
2:04 PM
yeah
	private final List<GameEventListener> listeners = new ArrayList<GameEventListener>();
 
@Unihedron thats just eclipse adds the to do thing...
 
I was thinking of writing it perfectly
I don't care about losing 10% as late penalty
 
@Unihedron i dont see why cant the parameters be passed :(
 
I really put too much in this game to not make it work the way I want :)
	private final List<GameEventListener> listeners = new ArrayList<GameEventListener>();
 
used simple request.getParameter("parameterName")
 
2:05 PM
I used java.util.List
 
@IbrahimNadir where?
 
still same problem
The List and ArrayList seem different
 
This is the part i'm talking about: String idRiparazione = request.getParameter("idRiparazione");
String idMandrinoSmontato = request.getParameter("idMandrinoSmontato");
String serviceLivello = request.getParameter("serviceLivello");

PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<h1>Hello Servlet Get</h1>");
out.println(idMandrinoSmontato);
out.println(serviceLivello);
out.println("</body>");
out.println("</html>");
is it okay to paste code like that? Sorry but i'm new.
 
Use fixed font. Check out the help pages too.
 
the output to this is: Hello Servlet Get. null null
Sure will do. thanks!
 
2:08 PM
@Sabಠ_ಠ List is an interface that ArrayList implements. So you can assign an ArrayList<GameEventListener> to List<GameEventListener>. But that List must be java.util.List. If you have java.awt.List in your imports, remove that
 
aha!
i didn't even notice it's awt lol
 
(More of interfaces. You'll become an expert in those soon)
 
I really love the layout and interface
It's just time was limited
I won't submit it today I'll do it tomorrow I wanna get the interface right once for all
import java.util.List;
I used that still get the error
 
Do you have the awt list in the imports too?
 
nop
i have awt.event
I added ArrayList now it works
import java.awt.event.*;
import java.util.ArrayList;
import java.util.List;
By works I mean no syntax error
 
2:12 PM
thank you with the edition version of question @Unihedron
 
ah. that would have been a different error. good that you fixed it though
 
@Unihedron is it okay to send file and other parameters to servlet? Technically, should it work?
 
Technically yes. Practically I've no experience doing that.
 
My question isn't entertained at all. Don't know the reason.
 
I got a feeling I'm close @kiheru
I now added this to my SidePanel class:
@Override
	public void pieceEaten(ImageIcon pawnOut) {
		//stuff

	}
 
2:18 PM
seems fine. (assuming that's the method signature you defined in GameEventListener)
 
@IbrahimNadir added language tag. brace yourselves for possible traffic & downvotes
 
public interface GameEventListener {
	void pieceEaten(ImageIcon pawnOut);

}
 
I'd likely add there some debugging output at this stage, just to check the method gets called at appropriate times, and only after that proceed to the real implementation
 
@Unihedron language tag?
 
yep
 
2:19 PM
@IbrahimNadir .
 
i'm using a print to test it now
So I'll just change it to string at this stage
 
what should it be then? @Unihedron
 
Hey @Unihedron
 
hiya @Bohemia :)
I added the tag on your question @IbrahimNadir.
 
You wasn't here that day.
 
2:21 PM
@Unihedron doesn't matter as long as i get the answer. ;)
 
@Bohemia oh? Which day?
 
Day before yesterday I guess. I don't remember for sure.
 
@Unihedron should there be another chat room i need to ask this question in?
 
@IbrahimNadir JSP for java server pages right? This is the best room to go for, except our jsp experts doesn't seem to be online. I'm not very experienced with jsp.
 
yes :) let me give it a try...
@Unihedron Thank you very much...
 
2:24 PM
Holy SHIT!
@kiheru I'm weeping <3
If I manage to make the full stuff in thirty minutes with comments I might get a 100% but I wanna add more stuff to it :D
interface is just that awesome ;D
 
is it working as intended?
 
Yep :D
But the problem I'm thikning about
 
the prof will probably appreciate the use of a proper design pattern in the game :-)
 
Yep :)
I learned so much from you :) thanks a lot :)
I got one question now. Instead of printing i will add an image to a Jpanel eveytime
but the problem is
I need to create the panel inside the listener
So is a panel added on top of the previous everytime?
 
A word of warning about making the code perfect - it'll never be. At some stage you'll just need to decide it's good enough, and that's usually well before than you actually think it's good enough
 
2:28 PM
yeah :)
 
lolz, nice advice !
 
I wrote my code 5 times
the first 3 were always having the out of bounds
and then your idea of using absolute values was just perfect
I even got an idea how to write a computer player now :D
but I won't have time I may do it during my holidays
 
@Unihedron I got an error in a program, where should I post it on chat?
 
@Sabಠ_ಠ So you want to add pieces as images to the side panel every time a piece is eaten?
 
2:31 PM
@Bohemia Dump it on pastebin.com or pastie.org, link here, and poke some people who aren't busy.
 
yep
I'm writing it right now
Pretty sure it will work but the thing is everytime I fire up the listener a panel will be created
not sure if the previous one goes away
 
@Unihedron is that for me?
 
@IbrahimNadir Mmm, delicious cake
 
@Unihedron not native english speaker. sorry mate. or maybe i just dont get it :/
 
OK. You can add components to a container at runtime (JLabel can display Icons, so you'll probably want to use those). But you'll need to call "revalidate(); repaint()" on the panel after changing the contents at run time
 
int iconWidth = pawnOut.getIconWidth();
int iconHeight = pawnOut.getIconHeight();
JLabel pawnRemoved = new JLabel(pawnOut);
pawnRemoved.setBounds(width, height, iconWidth, iconHeight);
whitePane.add();
I'm trying to make them appear random :D
 
please don't use setBounds() If the prof knows swing he'll reduce your score for that
 
ohh
why?
but how will i display each pawn randomly on the spot?
 
It's usually bad idea. Though for random placement probably not so much
 
This was the best way I could think of lol
 
2:36 PM
Can anyone check it? I'm getting an error related main method can not be static.
 
is there something else other than setBounds?
 
Not really. Random placement is probably one of those 1 in 1000 cases where use of it could be appropriate
 
aha :D
I'm 1 in 1000 how cool is that?
 
The side panel will need null layout manager for that.
 
I so wanted to implement this idea :)
 
2:40 PM
(Rare enough that I have never used it. In the only case where I at first though null layout could work (free placement), I eventually wrote a layout manager that ensured the items stayed at visible area)
 
aha
I now appreciate Java a lot.
I hated it at first, was so intimidating. It's so powerful what we can do with it. Looks like I need to move from my basic textbook to some more advanced stuff
 
That was a code that let the user arrange items on a screen, and they'd keep positions between different runs. The issue was that the area could change in size, so things could end up being unreachable. A layout manager was in a good position to ensure that everything stays on the screen, despite resizing the area
 
yeah :)
I just uset setResizable(false) and then added my own sexy buttons :)
the game doesn't need to be maximized I made it so that it can run on a primitive 1024x768 :)
 
@Bohemia on class postGrad_admission extends grad_admission
No enclosing instance of type stud_info is available due to some intermediate constructor invocation
 
You'll want to use a random number between [0, panelWidth - pieceWidth] for the positions
similarly for Y position
 
2:47 PM
That's the problem now
Everytime I eat one it displays only 1 outside
 
and, for a restarted game, you may want another event type: a restart (that should clear the side panel)
 
@Unihedron what to do now?
 
it's like they are getting stacked on each other
ohh
 
because you're not using any random numbers
 
yeo
How can i make the number random everytime?
int width = (int)(Math.random() * (210));
int height = (int)(Math.random() * (210));
 
2:49 PM
This is what you want to use for the random ints: docs.oracle.com/javase/7/docs/api/java/util/…
 
it's not really random right now due to the seed right?
haha I knew I needed a loop. :D
 
multiplying by Math.random() works, but using Random.nextInt(int) is better
 
Math Random doesn't work for me unless I put it inside a loop
I wonder why
 
hmm?
 
or maybe it's making a new panel everytime and stacking it on the previous?
I'm pretty sure the latter is happening
 
2:52 PM
Note that for the side panel you'll need to use null layout. BorderLayout will try to place the pieces as BorderLayout usually does
That is the problem
 
I actually divised the side panel into 2
north an south
in each there's another panel white and red
 
Well, each of the places that require random placement, will need null layout
 
aha
so basically the red and white panel don't need a layout
 
because otherwise the layout manager will try to do its job
and place the pice at BorderLayout.CENTER
 
yep
works now
 
2:55 PM
and you don't want that
 
I knew it
a new panel is stacked on the other everytime
here's what my event does
 
You'll probably want to add a comment at the setLayout(null) calls, that it's required for the random placement. OK - now to think about it - I would not use null layout after all. I'd Implement a layout manager that does random placement :-D
 
:P
but I wanna know something, is it replacing the previous panel with another one?
 
Your code seems to do that with the white and red panels. I'd create them once at the constructor
And then just add pieces to appropriate panels at pieceEaten()
 
actually I did
the problem is the adding
the panel is not defined in the event then
so if I put whitePane in my contructor, and use it inside
 
3:04 PM
You can have the panels as fields. Then you don't need to create them more than once
 
lemme try this approach :)
But it's a textfield
doesn't work
too bad :/
 
why? A field in Sidepanel:
     private final JPanel whitePanel;
and initializing  (and placing, and setting the layout) it in the constructor should work just fine. Then you can simply add to it in `pieceEaten()`
 
Oh
But wait
I did that too
ah didn't set it as final :P
lemme see if it works now
 
did you accidentally redeclare whitePanel somewhere? The local declaration shadows the field declaration in that case
 
3:18 PM
Making it final is good practice in any case. Keeps you from accidentally overwiting them, and ensures you initialize them in the constructor (or in place, or in an initializer block)
 
doesntn seem to work :(
 
What exactly does not work?
 
the icons don't appear at all now when I jump
 
hmm, try adding whitePane.repaint() after adding the piece
 
Holy kiheru :D
You genius :D
I can even add sounds
show which player plays
 
3:24 PM
I just know the swing painting mechanism quite well
 
show the score as well now :D
@kiheru where did you learn all this?
 
Writing and maintaining a game client
 
were books involved?
I have so many ideas but if I know the stuff which I have to use I can make them. That's theproblem it's been just 4-5 weeks I'm doing java
 
The only swing book I have read is Filthy rich clients. I had been using swing for a while already when I did that (it's not a beginner's book anyway, so maybe better that way). The net is full of useful resources
 
yep
we are using Absolute Java for class it's not in depth
I guess I need to find more advanced books now and most importantly learn how to use the docs
java docs is weird to me
it's not like python
 
3:33 PM
<lecturing_mode>Today's main lesson was the Observer pattern. So take care that you understand how and why the whole listener thingy works. It's one of the more common and most useful design patterns. Common enough that C# added syntax to help writing them</lecturing_mode>
 
:)
11 mins ago, by Sab ಠ_ಠ
I can even add sounds
:D
I can now use this to make my textfield work
it will show the player's turn
the score
:D
The thing we can do is limitless and you made it so simple in the explanation although I was freaking out about a deadline I managed to make it :D
 
woohoo!
 
Again thanks a lot for teaching me all this :D
You're 1 great mentor :)
 
You're welcome. You can return the favor to someone else some day
 
^^^^^^
 
3:40 PM
I love doing that actually :)
People who know their stuff always inspire me
I actually taught my friends how to use layout manager :D
I read it one day did my grid and explained to others :D
the best part is you understand more ;D
 
Can anyone refer to a good site/document for Q&A with "What is this program doing" and "Write code that accomplishes this" type questions? Had an interview the other day, and I wasted valuable time identifying what the code was doing, and for the write code questions, coming up with how I was going to write it. So I figure doing a bunch of questions will speed me up!
 
I think you should code more?
I'm still new but there are times when I can't identify a code and I realise I don't know it much even if I used it before
 
@FinalFind Yes! Do more practices! Would you like recommendations?
 
brb dinner time :)
 
Here's a progressive exercise on logical tasks and string manipulation: codingbat.com/java
 
3:50 PM
hungry and happy today ;-; :D
 
I do practice, but I would like to get exposed to a number of different questions to more broadly prepare myself
Oh and @Unihedron thanks, checking out that link
If there is any more anyone can point out it would be most welcome!
 
4:11 PM
Boo
 
yah
 
:P
What's going on?
 
4:39 PM
Empirically, nothing!
 
 
1 hour later…
6:09 PM
hallo everyone :)
 
java sucks indeed
:(
 
U mad bro? Java is brilliant
 
Can anyone confirm if there's any issues with the Oracle website and downloading the JDK?
 
the more you learn the more you will realise it's awesome
 
For some reason, it won't let me download it
It did previously
or I thought I had the JDK
 
6:12 PM
You need to accept he agreement
then you will be allowed to click download
 
but idk, after I downloaded IntellJ IDEA , it disappeared
I did accept the license agreement
It redirects me to a page that says
 
maybe you downloaded the wrong version
 
I didnt' accept it EVEN though I did
I am trying to download the jdk f8u20
 
change browser and try again
 
*8U20
FML
 
6:13 PM
maybe you got some browser spyware
second
 
I tried on IE, firefox and chrome
:(
It's strange because I previously did have the jdk on my computer... I had to because I was compiling projects in Eclipse
 
Sorry!
In order to download products from Oracle Technology Network you must agree to the OTN license terms.
Be sure that...
Your browser has "cookies" and JavaScript enabled.
You clicked on "Accept License" for the product you wish to download.
You attempt the download within 30 minutes of accepting the license.
From here you can go...
Back to Previous Page
Site Map
dafak
 
but I just downloaded the IntelliJ IDEA and now everything is messed up.
 
I dunno I can't even dld it lol :P
 
yes that's the error!!!
So I'm not going crazy, thank you!
@_@
 
6:15 PM
Nop you're not it's a problem with their site
that was awkward
 
fucking oracle
now I can't do development
:(
 
daww take a nap or watch a movie :D
 
yeah I have a early scrum meeting soon and I will tell my PM I could not do anything productive today because of Oracle
 
yeah
:P
try CNET maybe
 
lol
I will try CNET
 
6:18 PM
do you know swing?
 
Java Swing?
 
I haven't done Swing in 2 years... not sure I remember too well but yeah
 
I made an interface and I'm trying to make an event that changes the text in a textarea
 
Do you have a swing question?
 
6:19 PM
but it doesn't appear
 
ok.
 
yea
 
hm
put your code in a gist
 
pastebin?
 
and I can take a look
sure that's fine
 
6:21 PM
basically this is what fires up the event
	private void playerTurn(int playerNumber){

		if(playerNumber == 1){
			for (GameEventListener listeners : listeners) {
				listeners.player("Red");
		    }

		}else if(playerNumber == 2){
			for (GameEventListener listeners : listeners) {
				listeners.player("White");
		    }
		}
	}
 
6:50 PM
simple checks... Is the player number ever set to 1 or 2?
Make sure you also use the debugger to check and see if the code is being hit
 
yea they are set
actually I already have an event happening
I made another event in the same interface
to make something else happen
but it doesn't work
the other event works just fine
 
Where are you calling the event?
Also what is the event in this case?
 

« first day (1420 days earlier)      last day (3520 days later) »