• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:53
CEST 17:53
KST 00:53
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL20] Ro24 Preview Pt2: Take-Off6[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18
Community News
Weekly Cups (Aug 18-24): herO dethrones MaxPax4Maestros of The Game—$20k event w/ live finals in Paris30Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195
StarCraft 2
General
Weekly Cups (Aug 18-24): herO dethrones MaxPax What mix of new and old maps do you want in the next 1v1 ladder pool? (SC2) : A Eulogy for the Six Pool Geoff 'iNcontroL' Robinson has passed away 2v2 & SC: Evo Complete: Weekend Double Feature
Tourneys
WardiTV Mondays Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies
Strategy
Custom Maps
External Content
Mutation # 488 What Goes Around Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below
Brood War
General
BW General Discussion Flash On His 2010 "God" Form, Mind Games, vs JD BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ro24 Preview Pt2: Take-Off No Rain in ASL20?
Tourneys
[ASL20] Ro24 Group E [Megathread] Daily Proleagues [ASL20] Ro24 Group D [ASL20] Ro24 Group B
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread General RTS Discussion Thread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine The year 2050 European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4168 users

The Big Programming Thread - Page 197

Forum Index > General Forum
Post a Reply
Prev 1 195 196 197 198 199 1031 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Craton
Profile Blog Joined December 2009
United States17250 Posts
Last Edited: 2012-11-17 01:18:22
November 17 2012 01:16 GMT
#3921
Build - Compile "changed" or not compiled files
Clean - Remove existing compiled files
Rebuild - Clean + Build
twitch.tv/cratonz
kaykaykay
Profile Joined July 2012
Singapore637 Posts
Last Edited: 2012-11-17 01:47:16
November 17 2012 01:45 GMT
#3922
On November 16 2012 19:59 Frigo wrote:
Show nested quote +
On November 15 2012 23:55 kaykaykay wrote:
Is there anybody decent with Object oriented programing eclipse java here? :D

How can we help?


Hi Frigo,
How do you use a class diagram to help you write codes?
I've no idea where to start.

[image loading]
Starve the ego, feed the soul.
Craton
Profile Blog Joined December 2009
United States17250 Posts
Last Edited: 2012-11-17 03:12:26
November 17 2012 03:11 GMT
#3923
I'm assuming homework assignment?

Just make classes for each block with the relevant properties and methods. It also has the flow of which classes should be calling which.

One class would be HappyFamilyGame which would have an array[5] of class Player and a method start() which takes nothing and returns nothing (i.e. void).
twitch.tv/cratonz
tec27
Profile Blog Joined June 2004
United States3701 Posts
November 17 2012 05:35 GMT
#3924
Oh god who designed such an awful set of classes. For future reference (I'm going to assume that you were given this by your instructor):
  • Never make classes called 'Helper'; these will always end up being generic grab-bags of functions. If your class doesn't keep any state, it probably shouldn't be a class (I know, Java boxes you in here because everything has to be in a class, but in more expressive languages this applies).
  • If you have a class like Deck, don't make methods that end with the class name (like createDeck, displayDeck, etc.). You already know you're dealing with a Deck from the object, no need to repeat this all over the place. It also makes polymorphism in inheriting classes more confusing.
  • Don't use arrays where lists are better suited and easier to use (namely 'hand' in Player, as well as the array of players, etc.). Regardless of the rules of the game, its very unlikely that one player will hold all the cards and everyone else will hold none, so you're allocating a lot of space that will sit empty the vast majority of the time. Lists certainly have more memory overhead than arrays, but they keep track of their length for you and you don't have to worry about adding too many things to them (hell, allocate ArrayLists with an initial size of 48 and you'll have almost identical space usage/performance but without all of the crappy length checks you'll have to make with arrays!)
Can you jam with the console cowboys in cyberspace?
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2012-11-17 07:51:06
November 17 2012 07:03 GMT
#3925
1. where should the stuff in Helper be then? just stuff in the Main? (or HappyFGame?)
2. cool tip
3. also cool, we have touched on arrays but not mentioned lists
i have C# assignment to do next (2 weeks i think) , look forward to organising myself better
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
kaykaykay
Profile Joined July 2012
Singapore637 Posts
Last Edited: 2012-11-17 07:24:11
November 17 2012 07:23 GMT
#3926
Oh right. Forgot to add this.

Required Functionalities:
User registration of up to five players (A to E).
Player's name must be three to eight characters.
Shuffle the 48 cards randomly.Distribute the cards equally to each of the registered players. A difference of one card between players is acceptable.
Display all players with all the cards that have been given to them.

Coding Restrictions:
You must use simple (1-D) arrays .
You are not allowed to use ArrayLists or LinkedLists.
You are not allowed to implement any form of GUI. (E.g. Swing, AWT, etc.)
Starve the ego, feed the soul.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2012-11-17 08:01:45
November 17 2012 07:52 GMT
#3927
On November 17 2012 16:23 kaykaykay wrote:
Oh right. Forgot to add this.

Required Functionalities:
User registration of up to five players (A to E).
Player's name must be three to eight characters.
Shuffle the 48 cards randomly.Distribute the cards equally to each of the registered players. A difference of one card between players is acceptable.
Display all players with all the cards that have been given to them.

Coding Restrictions:
You must use simple (1-D) arrays .
You are not allowed to use ArrayLists or LinkedLists.
You are not allowed to implement any form of GUI. (E.g. Swing, AWT, etc.)


First off, we are not here to do your assignment for you. We can help in debugging if you've given up on life after 8 hours on one bug, or if you've been stumped on a specific implementation and have exhausted your coffee supply, or if you have any secondary, more abstract questions about your work. This is not a homework thread, but most of the time, we'll give you the benefit of the doubt when you need some help, that you've actually been staring at this problem and trying to code for hours and making no progress. But at the moment, you really make it seem like you just want us to complete it for you.


If this is your first programming assignment ever and you're not planning to be in a Computer Science relevant industry, then I feel for you, but it's very unlikely that the teacher just threw you into here without teaching you incrementally all the required steps.

You are given the entire class diagram, which involves several classes, what functions should exist in each class, what those functions should do, and how they interact with each other. Your only job is to decide on an appropriate data structure to use for each class implementation, implement each function, and then link them all together in a main loop.

Your class implementation is already restricted for you; you can't use ArrayLists or LinkedLists. Ask yourself, what's left?

You function implementations begin at the simplest level, in this case, the lowest class in the class diagram, the card.

Implement all the functions of the card, then test that they do what they're required to do. Once you're done that level, move up another step to a higher level, where each step up uses the new classes that you've implemented. Unless you have a lot of experience, you cannot implement a class without implementing the classes that it depends on. How can you dealCards() if you haven't created the structure for a Deck and Card yet?

The class diagram gives you a visual representation of how to implement the solution to a problem, which is a Happy Family Game in this case. They help you by simplifying the "what to implement and their relationships" portion and let you focus on "how to implement," once you've verified that the diagram is correct.


All of your restrictions should be fairly obvious with how they fit into the class diagrams.

There is no one like you in the universe.
kaykaykay
Profile Joined July 2012
Singapore637 Posts
Last Edited: 2012-11-17 08:31:34
November 17 2012 08:27 GMT
#3928
On November 17 2012 16:52 Blisse wrote:
Show nested quote +
On November 17 2012 16:23 kaykaykay wrote:
Oh right. Forgot to add this.

Required Functionalities:
User registration of up to five players (A to E).
Player's name must be three to eight characters.
Shuffle the 48 cards randomly.Distribute the cards equally to each of the registered players. A difference of one card between players is acceptable.
Display all players with all the cards that have been given to them.

Coding Restrictions:
You must use simple (1-D) arrays .
You are not allowed to use ArrayLists or LinkedLists.
You are not allowed to implement any form of GUI. (E.g. Swing, AWT, etc.)


First off, we are not here to do your assignment for you. We can help in debugging if you've given up on life after 8 hours on one bug, or if you've been stumped on a specific implementation and have exhausted your coffee supply, or if you have any secondary, more abstract questions about your work. This is not a homework thread, but most of the time, we'll give you the benefit of the doubt when you need some help, that you've actually been staring at this problem and trying to code for hours and making no progress. But at the moment, you really make it seem like you just want us to complete it for you.


If this is your first programming assignment ever and you're not planning to be in a Computer Science relevant industry, then I feel for you, but it's very unlikely that the teacher just threw you into here without teaching you incrementally all the required steps.

You are given the entire class diagram, which involves several classes, what functions should exist in each class, what those functions should do, and how they interact with each other. Your only job is to decide on an appropriate data structure to use for each class implementation, implement each function, and then link them all together in a main loop.

Your class implementation is already restricted for you; you can't use ArrayLists or LinkedLists. Ask yourself, what's left?

You function implementations begin at the simplest level, in this case, the lowest class in the class diagram, the card.

Implement all the functions of the card, then test that they do what they're required to do. Once you're done that level, move up another step to a higher level, where each step up uses the new classes that you've implemented. Unless you have a lot of experience, you cannot implement a class without implementing the classes that it depends on. How can you dealCards() if you haven't created the structure for a Deck and Card yet?

The class diagram gives you a visual representation of how to implement the solution to a problem, which is a Happy Family Game in this case. They help you by simplifying the "what to implement and their relationships" portion and let you focus on "how to implement," once you've verified that the diagram is correct.


All of your restrictions should be fairly obvious with how they fit into the class diagrams.



Firstly yes I did post for help because I thought you guys could give me a headups on where to start. But I never told nor expected anyone to do it for me. If you noticed, I asked if anyone was good at OOP, before asking for help.
Nevertheless I'm sorry if I made it seem that way to you.

Secondly, I posted the coding restrictions because tec27 mentioned ArrayLists and it was only right to inform him that I couldn't use that. Not for anyone to do my assignment for me.

Thirdly, yes it's my first assignment.

Lastly, thanks for telling me that I should start coding at the Card class because it is the lowest class. It was all I really needed.

Edit: When you say appropriate data structure to use for each class implementation, you mean either Int, Str, Double etc.. Yeah?
Starve the ego, feed the soul.
tec27
Profile Blog Joined June 2004
United States3701 Posts
November 17 2012 08:57 GMT
#3929
On November 17 2012 16:03 FFGenerations wrote:
1. where should the stuff in Helper be then? just stuff in the Main? (or HappyFGame?)
2. cool tip
3. also cool, we have touched on arrays but not mentioned lists
i have C# assignment to do next (2 weeks i think) , look forward to organising myself better

For the Helper stuff, you should generally find a better abstraction for it. That class in particular looks to be for converting strings to other types, so it might just be a matter of naming (it might be better called StringConverter or something along those lines). If its meant to read multiple things out of the same string (IE: like the Scanner class in Java) then you'd want to have some sort of state kept internally, as well as a different name.

Basically you want to name things such that other people (and yourself after you write it) can understand very clearly what functionality belongs in a class and what doesn't. A name like 'Helper' can apply to just about anything, so you end up with a ton of unrelated stuff in it eventually.
Can you jam with the console cowboys in cyberspace?
supereddie
Profile Joined March 2011
Netherlands151 Posts
Last Edited: 2012-11-17 09:04:09
November 17 2012 09:02 GMT
#3930
Just a tip: for homework stuff, do exactly what you are given, including classnames and datatypes. Do not change any of this, as some professors will just mark it as failed because you didn't stick to the task. In your situation you are explicitly given a class model including restrictions. Do not try to be clever and come up with a dfferent structure, names etc unless your professor gives you the OK for it.

Ofcourse, you can create the clever stuff if you want, just don't turn it in. Unless you want to get into a hefty discussion...
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2012-11-17 09:09:24
November 17 2012 09:06 GMT
#3931
On November 17 2012 17:27 kaykaykay wrote:
Show nested quote +
On November 17 2012 16:52 Blisse wrote:
On November 17 2012 16:23 kaykaykay wrote:
Oh right. Forgot to add this.

Required Functionalities:
User registration of up to five players (A to E).
Player's name must be three to eight characters.
Shuffle the 48 cards randomly.Distribute the cards equally to each of the registered players. A difference of one card between players is acceptable.
Display all players with all the cards that have been given to them.

Coding Restrictions:
You must use simple (1-D) arrays .
You are not allowed to use ArrayLists or LinkedLists.
You are not allowed to implement any form of GUI. (E.g. Swing, AWT, etc.)


First off, we are not here to do your assignment for you. We can help in debugging if you've given up on life after 8 hours on one bug, or if you've been stumped on a specific implementation and have exhausted your coffee supply, or if you have any secondary, more abstract questions about your work. This is not a homework thread, but most of the time, we'll give you the benefit of the doubt when you need some help, that you've actually been staring at this problem and trying to code for hours and making no progress. But at the moment, you really make it seem like you just want us to complete it for you.


If this is your first programming assignment ever and you're not planning to be in a Computer Science relevant industry, then I feel for you, but it's very unlikely that the teacher just threw you into here without teaching you incrementally all the required steps.

You are given the entire class diagram, which involves several classes, what functions should exist in each class, what those functions should do, and how they interact with each other. Your only job is to decide on an appropriate data structure to use for each class implementation, implement each function, and then link them all together in a main loop.

Your class implementation is already restricted for you; you can't use ArrayLists or LinkedLists. Ask yourself, what's left?

You function implementations begin at the simplest level, in this case, the lowest class in the class diagram, the card.

Implement all the functions of the card, then test that they do what they're required to do. Once you're done that level, move up another step to a higher level, where each step up uses the new classes that you've implemented. Unless you have a lot of experience, you cannot implement a class without implementing the classes that it depends on. How can you dealCards() if you haven't created the structure for a Deck and Card yet?

The class diagram gives you a visual representation of how to implement the solution to a problem, which is a Happy Family Game in this case. They help you by simplifying the "what to implement and their relationships" portion and let you focus on "how to implement," once you've verified that the diagram is correct.


All of your restrictions should be fairly obvious with how they fit into the class diagrams.



Firstly yes I did post for help because I thought you guys could give me a headups on where to start. But I never told nor expected anyone to do it for me. If you noticed, I asked if anyone was good at OOP, before asking for help.
Nevertheless I'm sorry if I made it seem that way to you.

Secondly, I posted the coding restrictions because tec27 mentioned ArrayLists and it was only right to inform him that I couldn't use that. Not for anyone to do my assignment for me.

Thirdly, yes it's my first assignment.

Lastly, thanks for telling me that I should start coding at the Card class because it is the lowest class. It was all I really needed.

Edit: When you say appropriate data structure to use for each class implementation, you mean either Int, Str, Double etc.. Yeah?


That's okay, I did notice someone ask, but I didn't recognize that it was you. All I saw was a big diagram, and a listing of requirements. My bad. At the very least, it keeps everyone honest, which is nice.

By structure, I meant choosing a data structure where not explicitly stated, specifically between ArrayLists and LinkedLists, though I believe there aren't many cases where ArrayLists are even used, and LinkedLists are overkill in this application. Not a real big Java programmer myself, so I can only be of limited help there.

Make sure you follow the exact guidelines your professor gave.
There is no one like you in the universe.
tec27
Profile Blog Joined June 2004
United States3701 Posts
November 17 2012 09:55 GMT
#3932
On November 17 2012 18:06 Blisse wrote:
Show nested quote +
On November 17 2012 17:27 kaykaykay wrote:
On November 17 2012 16:52 Blisse wrote:
On November 17 2012 16:23 kaykaykay wrote:
Oh right. Forgot to add this.

Required Functionalities:
User registration of up to five players (A to E).
Player's name must be three to eight characters.
Shuffle the 48 cards randomly.Distribute the cards equally to each of the registered players. A difference of one card between players is acceptable.
Display all players with all the cards that have been given to them.

Coding Restrictions:
You must use simple (1-D) arrays .
You are not allowed to use ArrayLists or LinkedLists.
You are not allowed to implement any form of GUI. (E.g. Swing, AWT, etc.)


First off, we are not here to do your assignment for you. We can help in debugging if you've given up on life after 8 hours on one bug, or if you've been stumped on a specific implementation and have exhausted your coffee supply, or if you have any secondary, more abstract questions about your work. This is not a homework thread, but most of the time, we'll give you the benefit of the doubt when you need some help, that you've actually been staring at this problem and trying to code for hours and making no progress. But at the moment, you really make it seem like you just want us to complete it for you.


If this is your first programming assignment ever and you're not planning to be in a Computer Science relevant industry, then I feel for you, but it's very unlikely that the teacher just threw you into here without teaching you incrementally all the required steps.

You are given the entire class diagram, which involves several classes, what functions should exist in each class, what those functions should do, and how they interact with each other. Your only job is to decide on an appropriate data structure to use for each class implementation, implement each function, and then link them all together in a main loop.

Your class implementation is already restricted for you; you can't use ArrayLists or LinkedLists. Ask yourself, what's left?

You function implementations begin at the simplest level, in this case, the lowest class in the class diagram, the card.

Implement all the functions of the card, then test that they do what they're required to do. Once you're done that level, move up another step to a higher level, where each step up uses the new classes that you've implemented. Unless you have a lot of experience, you cannot implement a class without implementing the classes that it depends on. How can you dealCards() if you haven't created the structure for a Deck and Card yet?

The class diagram gives you a visual representation of how to implement the solution to a problem, which is a Happy Family Game in this case. They help you by simplifying the "what to implement and their relationships" portion and let you focus on "how to implement," once you've verified that the diagram is correct.


All of your restrictions should be fairly obvious with how they fit into the class diagrams.



Firstly yes I did post for help because I thought you guys could give me a headups on where to start. But I never told nor expected anyone to do it for me. If you noticed, I asked if anyone was good at OOP, before asking for help.
Nevertheless I'm sorry if I made it seem that way to you.

Secondly, I posted the coding restrictions because tec27 mentioned ArrayLists and it was only right to inform him that I couldn't use that. Not for anyone to do my assignment for me.

Thirdly, yes it's my first assignment.

Lastly, thanks for telling me that I should start coding at the Card class because it is the lowest class. It was all I really needed.

Edit: When you say appropriate data structure to use for each class implementation, you mean either Int, Str, Double etc.. Yeah?


That's okay, I did notice someone ask, but I didn't recognize that it was you. All I saw was a big diagram, and a listing of requirements. My bad. At the very least, it keeps everyone honest, which is nice.

By structure, I meant choosing a data structure where not explicitly stated, specifically between ArrayLists and LinkedLists, though I believe there aren't many cases where ArrayLists are even used, and LinkedLists are overkill in this application. Not a real big Java programmer myself, so I can only be of limited help there.

Make sure you follow the exact guidelines your professor gave.

ArrayLists are used a helluva lot in Java

Anyway, I wasn't saying you *should* used lists for this assignment, just that your instructor is dumb and is setting a bad example for you. A really bad example. Do what it takes to complete the assignment and then purge all of his shitty design and shitty type usage from your mind.
Can you jam with the console cowboys in cyberspace?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
November 17 2012 10:30 GMT
#3933
On November 17 2012 18:55 tec27 wrote:
ArrayLists are used a helluva lot in Java


What's the difference between ArrayLists, LinkedLists, and Lists? o:
There is no one like you in the universe.
heishe
Profile Blog Joined June 2009
Germany2284 Posts
November 17 2012 11:14 GMT
#3934
On November 17 2012 19:30 Blisse wrote:
Show nested quote +
On November 17 2012 18:55 tec27 wrote:
ArrayLists are used a helluva lot in Java


What's the difference between ArrayLists, LinkedLists, and Lists? o:


I haven't programmed Java a lot so AFAIK List is just the base class for ArrayList and LinkedList, but no guarantee for that.

LinkedList and ArrayList are the same in usage and behavior, they just differ in how they're implemented internally. In short: ArrayList is always faster on modern machines, so never used LinkedList.
If you value your soul, never look into the eye of a horse. Your soul will forever be lost in the void of the horse.
tec27
Profile Blog Joined June 2004
United States3701 Posts
November 17 2012 11:17 GMT
#3935
On November 17 2012 19:30 Blisse wrote:
Show nested quote +
On November 17 2012 18:55 tec27 wrote:
ArrayLists are used a helluva lot in Java


What's the difference between ArrayLists, LinkedLists, and Lists? o:

List is just an interface for any type of list of things (so both ArrayList and LinkedList implement List).

ArrayList is a dynamically sized array (basically, a data structure backed by an array that keeps track of its size. When the size would have to exceed the array size, it allocates a new array with a larger size (generally the size doubles each time, but its implementation dependent, I'm not sure what the specs are for Java's)).

LinkedList is a list backed by (obviously) a linked list.

So ArrayList has constant time access by index, on average constant time appending, and more expensive insertions/deletions. LinkedList would have constant time insertion/deletion, and then more expensive access by index.
Can you jam with the console cowboys in cyberspace?
Nitro68
Profile Blog Joined December 2007
France470 Posts
Last Edited: 2012-11-17 11:19:02
November 17 2012 11:18 GMT
#3936
Tec27 was faster
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
November 17 2012 12:12 GMT
#3937
On November 16 2012 22:01 flabbert wrote:
Show nested quote +
On November 16 2012 21:22 MisterD wrote:
On November 16 2012 20:52 flabbert wrote:
I have a fairly specific problem in php. I started teaching myself php a short while ago by writing an IRC gatherbot for CSGO gathers, however, i now want to get the serverlog from the CSGO server, and parse it. But i am having issues with both the socket connections needing data for the while loop to continue. There should be a way around this, but i have yet to understand how to do it properly.


you should really ask a question if you want an answer

dumb of me!

how do i manage 2 sockets in 1 while loop?

example:
+ Show Spoiler +

$socket = ircconnection;
$socket2 = csgoserverconnection;

while (!feof($socket) || !feof($socket2))
{
do stuff
}


i assume you want to terminate when either socket goes dead, so you'd have to do !feof($socket) && !feof($socket2) ;P
A quick google tells me there don't appear to be established standard patterns for doing this, so i guess the best you can do is switch to a while(true), to individual if(feof($socket)) {close($socket2); break;} and vice versa and then just handle reading for either sockets with a "if there is data, otherwise handle other socket" and not "wait until there is data (and ignore the other socket for that duration)".

I haven't touched php in ages, so i can't give you a proper explanation for that, just a general answer. Maybe someone else can do better, but otherwise i'd say just try around a bit and if you encounter a more specific problem ask about that.
Gold isn't everything in life... you need wood, too!
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
November 17 2012 12:59 GMT
#3938
On November 17 2012 10:45 kaykaykay wrote:
Show nested quote +
On November 16 2012 19:59 Frigo wrote:
On November 15 2012 23:55 kaykaykay wrote:
Is there anybody decent with Object oriented programing eclipse java here? :D

How can we help?


+ Show Spoiler +
Hi Frigo,
How do you use a class diagram to help you write codes?
I've no idea where to start.


[image loading]


What is the difference between a dotted arrow (like the one between Helper and HappyFamilyGame) and a solid arrow in association?
"When the geyser died, a probe came out" - SirJolt
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
Last Edited: 2012-11-17 15:14:11
November 17 2012 15:11 GMT
#3939
for a quick uml reference, i have bookmarked http://www.holub.com/goodies/uml/ - not perfect, but does the job. From there:

[image loading]
Dependency. User uses Resource, but Resource is not a member of (field in) the User class. If Resource is modified, some method of User might need to be modified. Resource is typically a local variable or argument of some method in User. The line is typically stereotyped (e.g. «creates» «modifies»)

[image loading]
Navigability Messages flow in direction of arrow (only). An unmarked line is "unspecified" navigability. An X indicates non-navigable (Uml 2.0). Typically, if a role is specified, then navigability in the direction of that role is implicit. If an object doesn't have a role in some relationship, then there's no way to send messages to it, so non-navigability is implicit.

so in essence, the Game uses the helper class internally, but it consists of players, decks and cards and given a game instance, you can access it's players, decks and cards, but not it's helper. solid arrow means "if you deal with X, you'll also deal with Y", dashed arrow means "if you want to use X, Y is used as well, but you don't need to concern yourself with it".
Gold isn't everything in life... you need wood, too!
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
November 17 2012 17:36 GMT
#3940
That site will come in handy, thanks
"When the geyser died, a probe came out" - SirJolt
Prev 1 195 196 197 198 199 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 8h 8m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko667
Hui .184
ProTech78
Codebar 46
MindelVK 40
StarCraft: Brood War
Calm 5452
Rain 3782
Horang2 3231
Bisu 2994
actioN 1041
Mini 613
Stork 486
ZerO 373
Light 355
Snow 347
[ Show more ]
Larva 307
Soulkey 228
Soma 165
Hyun 96
Movie 83
Sharp 57
[sc1f]eonzerg 54
Backho 47
ToSsGirL 30
Shine 24
Yoon 17
HiyA 14
scan(afreeca) 14
ajuk12(nOOB) 13
Terrorterran 12
SilentControl 9
Dota 2
Gorgc6313
qojqva2749
420jenkins277
XcaliburYe170
League of Legends
Reynor57
Counter-Strike
fl0m37
Other Games
singsing1741
hiko1063
FrodaN570
crisheroes381
ArmadaUGS69
QueenE61
ZerO(Twitch)10
KnowMe8
fpsfer 0
Organizations
StarCraft: Brood War
Kim Chul Min (afreeca) 13
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• poizon28 27
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV405
League of Legends
• Nemesis3491
• Jankos1264
• TFBlade328
Counter-Strike
• Shiphtur51
Upcoming Events
PiGosaur Monday
8h 8m
Afreeca Starleague
18h 8m
hero vs Alone
Royal vs Barracks
Replay Cast
1d 8h
The PondCast
1d 18h
WardiTV Summer Champion…
1d 19h
Replay Cast
2 days
LiuLi Cup
2 days
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
3 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
3 days
Team Hawk vs Team Dewalt
BSL Team Wars
3 days
Team Hawk vs Team Bonyth
[ Show More ]
SC Evo League
3 days
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
Maestros of the Game
4 days
ShoWTimE vs Cham
GuMiho vs Ryung
Zoun vs Spirit
Rogue vs MaNa
[BSL 2025] Weekly
4 days
SC Evo League
4 days
Maestros of the Game
5 days
SHIN vs Creator
Astrea vs Lambo
Bunny vs SKillous
HeRoMaRinE vs TriGGeR
BSL Team Wars
5 days
Team Bonyth vs Team Sziky
BSL Team Wars
5 days
Team Dewalt vs Team Sziky
Monday Night Weeklies
6 days
Replay Cast
6 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

CSLAN 3
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
MESA Nomadic Masters Fall
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.