Valhalla Legends Archive

Programming => General Programming => Topic started by: Joe[x86] on December 03, 2005, 12:37 AM

Title: [VB+Java] Final Project
Post by: Joe[x86] on December 03, 2005, 12:37 AM
Clicky (http://www.javaop.com/~joe/VBFinal.zip)

This is for a Visual Basic class (namely Computer Programming 1), where we're expected to have absolutely no knoledge of Java whatsoever, and rather limited VB skills (none at entry). Of course, I'm not normal, so eh? I wrote a chat server in Java, and a chat client in VB. Its a simple protocol, send your username with a space after it, then your message with a CRLF after it. All the server does is relay, theres absolutely no parsing involved.

I've still got four weeks to correct/add/whatever anything, so what do you have to say about it?
Title: Re: [VB+Java] Final Project
Post by: MyndFyre on December 03, 2005, 01:45 AM
Why is it ZIPped?
Title: Re: [VB+Java] Final Project
Post by: Yoni on December 03, 2005, 08:46 AM
If this is high school, you're gonna fail
Title: Re: [VB+Java] Final Project
Post by: Mangix on December 03, 2005, 02:57 PM
he's in 9th grade IIRC :P
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 03, 2005, 04:34 PM
Quote from: Mangix on December 03, 2005, 02:57 PM
he's in 9th grade IIRC :P
Omfg, stop stalking me. Yes, I'm a freshman in high school.

MyndFyre, because theres both a server and a client, each with binarys and source files encluded (or did I have a compiled client? I don't know).

Yoni, what do you suggest I change to make it non-failing? I've talked to Warrior and he suggests I use a binary protocol of some sorts.
Title: Re: [VB+Java] Final Project
Post by: Yoni on December 03, 2005, 05:06 PM
Quote from: Joe on December 03, 2005, 04:34 PM
Yoni, what do you suggest I change to make it non-failing? I've talked to Warrior and he suggests I use a binary protocol of some sorts.
No dude. I mean, if you're only in high school, chances are your teachers are too dumb to accept projects of this type. Make a calculator like everybody else. Jeez.
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 03, 2005, 06:10 PM
Nah, my teacher is pretty smart. I've shown her tons of Java stuff that I've done and she was pretty impressed, and she teaches Computer Programming 2, and AP Comp Prog 3-4, all of which are Java. I'm sure my client alone (which is like 30 lines of code) will blow away the rest of the projects.

EDIT -
Rewrote mass portions of the server to be more efficient overall:
-- Now using an InputStream instead of a BufferedReader
-- No longer using a timer in each individual client class. That cuts it down by 255 timers, so I'm happy. =)
Title: Re: [VB+Java] Final Project
Post by: FrOzeN on December 03, 2005, 06:50 PM
Through in a 'On Error Resume Next' in your Form_Resize() sub so it doesn't crash when resized to small. :P
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 03, 2005, 07:11 PM
Nice catch. How could I forget that?

I've switched to a binary protocol now, although its not much. I've got a mediocre userlist thing going on, but its printed to the screen. I'm going to move it to a listview! =)
Title: Re: [VB+Java] Final Project
Post by: rabbit on December 03, 2005, 07:34 PM
Quote from: FrOzeN on December 03, 2005, 06:50 PM
Through in a 'On Error Resume Next' in your Form_Resize() sub so it doesn't crash when resized to small. :P
That is possibly the worst idea ever.  Why not fix the problem instead of ignoring it?
Title: Re: [VB+Java] Final Project
Post by: Warrior on December 03, 2005, 07:43 PM
How do you fix it? I believe I just subclassed the mainform and didn't allow it to resize smaller than x and y. Even then it's a hassle because of debugging things in the future.
Title: Re: [VB+Java] Final Project
Post by: FrOzeN on December 03, 2005, 07:49 PM
Quote from: rabbit on December 03, 2005, 07:34 PM
Quote from: FrOzeN on December 03, 2005, 06:50 PM
Through in a 'On Error Resume Next' in your Form_Resize() sub so it doesn't crash when resized to small. :P
That is possibly the worst idea ever.  Why not fix the problem instead of ignoring it?
Not worth it really for such a simply school project. Though I guess he could through in some simply If statements instead..
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 03, 2005, 08:29 PM
Quote from: rabbit on December 03, 2005, 07:34 PM
Quote from: FrOzeN on December 03, 2005, 06:50 PM
Through in a 'On Error Resume Next' in your Form_Resize() sub so it doesn't crash when resized to small. :P
That is possibly the worst idea ever. Why not fix the problem instead of ignoring it?

Because the problem is caused by the user. Should I goto a error handler at the bottom, then

Call MsgBox("I've detected an error. You squeezed me. Fixing error..")
Call PunchInFace(App.User)
Title: Re: [VB+Java] Final Project
Post by: Stealth on December 03, 2005, 09:02 PM
Quote from: Joe on December 03, 2005, 08:29 PM
Quote from: rabbit on December 03, 2005, 07:34 PM
Quote from: FrOzeN on December 03, 2005, 06:50 PM
Through in a 'On Error Resume Next' in your Form_Resize() sub so it doesn't crash when resized to small. :P
That is possibly the worst idea ever. Why not fix the problem instead of ignoring it?

Because the problem is caused by the user. Should I goto a error handler at the bottom, then

Call MsgBox("I've detected an error. You squeezed me. Fixing error..")
Call PunchInFace(App.User)


Most all problems are caused by the user. Since punching them is impossible, you should just anticipate problems created by the user like this one and code such that they never become problems.
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 03, 2005, 11:51 PM
Seeing as how a perfect-looking GUI is not vital to the operation of this program, I'm going to have to go with ignoring it completely.
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 04, 2005, 02:02 PM
- Updated protocol specification telling when packets should be sent.
- Documented packet header.
- Documented packet footer.
- Fixed disconnect packet issue.

http://www.javaop.com/~joe/VBFinal.zip

I'm running a server on joex86.no-ip.org, if anyone wants to check it out.
Title: Re: [VB+Java] Final Project
Post by: Newby on December 04, 2005, 02:57 PM
Quote from: Joe on December 03, 2005, 11:51 PM
Seeing as how a perfect-looking GUI is not vital to the operation of this program, I'm going to have to go with ignoring it completely.

Seeing as how completing my homework in math is not vital to the completion of the class, I'm going to not do my homework in math.

I won't have an 'A', though. I may have something closer to a 'C' or a 'D'. (But for me, I have a 95% :))
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 04, 2005, 03:09 PM
Quote from: Newby on December 04, 2005, 02:57 PM
Quote from: Joe on December 03, 2005, 11:51 PM
Seeing as how a perfect-looking GUI is not vital to the operation of this program, I'm going to have to go with ignoring it completely.

Seeing as how completing my homework in math is not vital to the completion of the class, I'm going to not do my homework in math.

I won't have an 'A', though. I may have something closer to a 'C' or a 'D'. (But for me, I have a 95% :))

Ah Newby, I should teach you something you taught me. The beauty of open source is, if you don't like the way something works, you can fix it yourself. =)

EDIT -
I rarely do math homework either, so eh?
Title: Re: [VB+Java] Final Project
Post by: Newby on December 04, 2005, 04:09 PM
Quote from: Joe on December 04, 2005, 03:09 PM
Quote from: Newby on December 04, 2005, 02:57 PM
Quote from: Joe on December 03, 2005, 11:51 PM
Seeing as how a perfect-looking GUI is not vital to the operation of this program, I'm going to have to go with ignoring it completely.

Seeing as how completing my homework in math is not vital to the completion of the class, I'm going to not do my homework in math.

I won't have an 'A', though. I may have something closer to a 'C' or a 'D'. (But for me, I have a 95% :))

Ah Newby, I should teach you something you taught me. The beauty of open source is, if you don't like the way something works, you can fix it yourself. =)

Your teacher is not interested in my coding skills, or anybody else's coding skills for that matter. He's interested in yours.
Title: Re: [VB+Java] Final Project
Post by: UserLoser. on December 04, 2005, 04:20 PM
Quote from: Joe on December 04, 2005, 03:09 PM
Quote from: Newby on December 04, 2005, 02:57 PM
Quote from: Joe on December 03, 2005, 11:51 PM
Seeing as how a perfect-looking GUI is not vital to the operation of this program, I'm going to have to go with ignoring it completely.

Seeing as how completing my homework in math is not vital to the completion of the class, I'm going to not do my homework in math.

I won't have an 'A', though. I may have something closer to a 'C' or a 'D'. (But for me, I have a 95% :))

Ah Newby, I should teach you something you taught me. The beauty of open source is, if you don't like the way something works, you can fix it yourself. =)

EDIT -
I rarely do math homework either, so eh?

The beauty of closed source is, if you don't like the way something works, you can write your own and make it better instead of being lazy
Title: Re: [VB+Java] Final Project
Post by: dxoigmn on December 04, 2005, 04:59 PM
Quote from: UserLoser on December 04, 2005, 04:20 PM
The beauty of closed source is, if you don't like the way something works, you can write your own and make it better instead of being lazy

Awww, I thought this thread (http://forum.valhallalegends.com/index.php?topic=11078.0) would have changed you. Guess not :P
Title: Re: [VB+Java] Final Project
Post by: Newby on December 04, 2005, 07:14 PM
Quote from: UserLoser on December 04, 2005, 04:20 PM
The beauty of closed source is, if you don't like the way something works, you can write your own and make it better instead of being lazy

That's because if you are lazy, it doesn't get changed.

Also, the beauty of open source is, if you don't like the way something works, you can write your own or have someone else write it for you.

2 perks over 1!
Title: Re: [VB+Java] Final Project
Post by: rabbit on December 04, 2005, 07:49 PM
Quote from: Warrior on December 03, 2005, 07:43 PM
How do you fix it? I believe I just subclassed the mainform and didn't allow it to resize smaller than x and y. Even then it's a hassle because of debugging things in the future.
Private Sub Form_Resize()
    If Me.ScaleWidth > 0 Then
        ' resize y
    End If

    If Me.ScaleHeight > 0 Then
        ' resize x
    End If


If it's less than 0 they can't see it anyway, so there is no point in doing any resizing.
Title: Re: [VB+Java] Final Project
Post by: Warrior on December 04, 2005, 08:09 PM
That looks ugly + flickers :/
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 04, 2005, 08:41 PM
Guys, get over it. I am not going to modify my resize sub, unless I add new controls which need to be resized, etc.
Title: Re: [VB+Java] Final Project
Post by: Joe[x86] on December 04, 2005, 09:08 PM
-- Added error handler in Form_Unload to avoid errors when sending PKT_DISCONNECT when the socket is closed.
-- Server is now using a dynamicly size-increasing array of sockets, and the loops have been modified to work with this.
-- Now using port 8999 for communication instead of port 99, as port 99 is a restricted socket (except on Windows). Thanks iago!

http://www.javaop.com/~joe/VBFinal.zip

EDIT -
I'm running a RabbiChat server on iago's production server. www.javaop.com:8999.
Title: Re: [VB+Java] Final Project
Post by: rabbit on December 04, 2005, 09:45 PM
Quote from: Warrior on December 04, 2005, 08:09 PM
That looks ugly + flickers :/
Actually, it doesn't do either at all.