|
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. |
On November 15 2013 07:32 Ben... wrote:Show nested quote +On November 13 2013 07:39 darkness wrote:Can anyone recommend to me UML drawing tools please? I need to draw a class diagram, use case, sequence diagram, interface design (optionally). I feel MS Word can't help me much.  We have to use UMLet for that type of stuff. It does the job. If you are doing Java it can read in .java files and automatically create the classes for you. It will not create relationships between classes though. It's a simple Java Archive so you can run it on anything. I just leave it in my Dropbox folder. I've used UMLet myself for a few things, not even programming related, it's pretty easy to use and quite multifunctional.
|
Hello, not sure if I can ask for help here..but I just started learning Java.
I need to make a program that tries to imitate a mouse cursor movement. It requires me to get an input 1 from user in pairs (x,y) first set being the max x and max y of the border/screen. and then from there the user continues to inputs (x,y), which is the movement of the cursor.
How do i collect an input as a pair?
|
On November 15 2013 14:22 ChEDo wrote: Hello, not sure if I can ask for help here..but I just started learning Java.
I need to make a program that tries to imitate a mouse cursor movement. It requires me to get an input 1 from user in pairs (x,y) first set being the max x and max y of the border/screen. and then from there the user continues to inputs (x,y), which is the movement of the cursor.
How do i collect an input as a pair?
The easiest way is probably to just ask for x and then for y.
Something like this (pseudocode, not real java functions)
print("Enter x coordinate"); int x = readInt(); print("Enter y coordinate"); int y = readInt();
|
Hey guys. I'm having trouble with my Java program where I get an out of bounds exception. The code this concerns is:
//generate random numbers for(int i = 1; i <= 40; i++) random.add((int)(Math.random()* -40 + 20)); for(int i = 1; i <= 40; i++) sum = random.get(i); //highlighted line of error. random is an ArrayList. avg = sum/40;
Any chance you guys know what I did horribly wrong?
|
Normally arrays start at 0 and not at one
|
On November 15 2013 22:26 3FFA wrote:Hey guys. I'm having trouble with my Java program where I get an out of bounds exception. The code this concerns is: //generate random numbers for(int i = 1; i <= 40; i++) random.add((int)(Math.random()* -40 + 20)); for(int i = 1; i <= 40; i++) sum = random.get(i); //highlighted line of error. random is an ArrayList. avg = sum/40;
Any chance you guys know what I did horribly wrong? 
Your array is of length 40. That would mean your indices go from 0 to 39, not 1 to 40.
|
On November 15 2013 22:31 devilesk wrote:Show nested quote +On November 15 2013 22:26 3FFA wrote:Hey guys. I'm having trouble with my Java program where I get an out of bounds exception. The code this concerns is: //generate random numbers for(int i = 1; i <= 40; i++) random.add((int)(Math.random()* -40 + 20)); for(int i = 1; i <= 40; i++) sum = random.get(i); //highlighted line of error. random is an ArrayList. avg = sum/40;
Any chance you guys know what I did horribly wrong?  Your array is of length 40. That would mean your indices go from 0 to 39, not 1 to 40. Doh! Thanks guys.
|
On November 13 2013 07:39 darkness wrote:Can anyone recommend to me UML drawing tools please? I need to draw a class diagram, use case, sequence diagram, interface design (optionally). I feel MS Word can't help me much. 
Sorry, I missed this post!
https://www.draw.io/
|
On November 15 2013 03:48 zzdd wrote:Show nested quote +On November 15 2013 01:09 heroyi wrote: + Show Spoiler + Question in C (any other related languages I suppose):
I have a question about malloc. Specifically the difference between that and just a defined array. I have read around but I am still having a hard time to wrapping my head around it. I know that malloc essentially means to allocate a specific amount of memory (whatever amount you choose so) for, usually, a pointer. Webs say that malloc is used for dynamic purposes (even faster than say vector in c++ since it doesnt have to "initialize" the memory with a bunch of zeros thus malloc being "faster"). But my problem is that too me it doesn't seem so dynamic since you have to define the malloc just like an defined array. Or does it work by adding a function/pointer or whatever solution you wish to implement to the malloc if it fails the if test (checking to see if there is enough memory, if not then add more?)
Those that can answer this can you also give a small example of malloc being dynamic.
tl;dr I don't understand how malloc is dynamic since the argument requires a define size. With malloc you don't have to know the size of the array before hand and you can make it any size. Hence it is easier to use for a dynamic set of inputs. If I'm getting input from a file or whatever that can have 0-1000+ entries, I can count the entries and make a perfectly sized array with malloc. With a normal array I would just have to make a huge array and hope its big enough and if the data is smaller your wasting space. Usually when calling malloc you use sizeof() for the size of your data type and then some variable that has the count of the entries to get the size of the array. Pretty much it just gives you a block of memory for you to use however you want. Another thing is if you get more information or less you can realloc or malloc again. Calloc btw has the initialization.
ahh thank you. That was the explanation I needed. For some reason I couldnt comprehend it. Thanks.
|
HTML5/css Question: Would you guys think it would be better to try to keep the contents of a website searchbar in the normal flow, or would it be acceptable to absolutely position them? I'm wondering if I shouldn't scrap the positioning I have right now and use display:table instead (and subsequently table-cell).
|
Hey guys, I guess I didn't update you about my work experience. No time for that right now anyway. Could you possibly have a quick look at this jpeg? My assignment is to plan out a Pokemon style game in C#. This is the class diagram which relates to my Use Cases. Specifically I think I momentarily confused myself because I wanted to name the Player attribute/s of Game class as activePlayer and nonActivePlayer. I'm 99% sure this is wrong. Anyway I've gone and made the jpeg now so might aswell post it and ask...Thanks 
![[image loading]](http://i.imgur.com/ckzaGBr.jpg)
ps: i just altered addMonster(): int to addMonster(Monster): int, and setActiveMonster(): Monster to setActiveMonster(Monster):int - think this is more correct as I'm passing in a Monster (and not just dealing with strings here...??)
hrm this is now raising the question of if i pass in a Player to initialSelection(): int and write it as initialSelection(Player): int. i guess I do since thats how i wrote it in Player for Monsters
my system looks at activePlayer's activeMonster (dead/alive), but really its looking at Player p1 (or p2's) activeMonster attribute. maybe i DO want to name p1/p2 as activePlayer/nonActivePlayer in Game class, that way I can refer to activePlayer and nonActivePlayer in the Game methods rather than having to check if p1 or p2 is activePlayer in my Game methods.....
or.... can i do something like this:
Game class
Player p1 Player p2 Player activePlayer Player nonActivePlayer
startGame->p1.setActive()
initialSelection() activePlayer-> doThis p2.setActive() p1.setNonActive() etc
OK what I'm doing for now is removing objects Player p1 and Player p2 and replacing them with Player activePlayer and Player nonActivePlayer. the reason for this is because we can set p1 as activePlayer from the get-go so don't need to start off calling it p1.
I've added setActive(): int to the Player class so we can go nonActivePlayer.setActive and activePlayer.setInactive (guess i should add setInactive() too)
now the last question is.... and i think i may have solved my confusion, we can write: initialSelection(Player): int selectMonster(Player): int etc
and that's fine - it only feels wrong coz in Game we are naming our indivudal player objects whereas comparitively in Player we have written our Monsters as an array so just refer to them as Monster (rather than , say monster1, monster2)
the confusion now , i guess, is that in the Game methods we are going to be passing in TWO objects (i think). do i write this as initialSelection(Player, Player): int? i guess not coz we're dealing with classes not objects. but when i comes to code it i guesss ill be passing in 2 of them... s
so..this is what i end up with.. :/
![[image loading]](http://i.imgur.com/joUNyP0.jpg)
do i really need all those (Player) bits in the Game functions?
OK I phoned someone and he suggested that I make Player activePlayer and Player nonActivePlayer into a Player[2] array (same as how I have my Monsters).
Array will allow me to quickly/cleanly search thru the 2 players and pick out which one is isActive (originally activePlayer) and interact with it. This solves my worry of messing around with if statements (if p1 is p1.isactive else if p2 is p2.isactive...) Brilliant!
|
On November 15 2013 22:46 ThatGuy wrote:Show nested quote +On November 13 2013 07:39 darkness wrote:Can anyone recommend to me UML drawing tools please? I need to draw a class diagram, use case, sequence diagram, interface design (optionally). I feel MS Word can't help me much.  Sorry, I missed this post! https://www.draw.io/
another choice is ArgoUML
|
On November 16 2013 02:12 FFGenerations wrote:Hey guys, I guess I didn't update you about my work experience. No time for that right now anyway. Could you possibly have a quick look at this jpeg? My assignment is to plan out a Pokemon style game in C#. This is the class diagram which relates to my Use Cases. Specifically I think I momentarily confused myself because I wanted to name the Player attribute/s of Game class as activePlayer and nonActivePlayer. I'm 99% sure this is wrong. Anyway I've gone and made the jpeg now so might aswell post it and ask...Thanks  ![[image loading]](http://i.imgur.com/ckzaGBr.jpg) ps: i just altered addMonster(): int to addMonster(Monster): int, and setActiveMonster(): Monster to setActiveMonster(Monster):int - think this is more correct as I'm passing in a Monster (and not just dealing with strings here...??) hrm this is now raising the question of if i pass in a Player to initialSelection(): int and write it as initialSelection(Player): int. i guess I do since thats how i wrote it in Player for Monsters my system looks at activePlayer's activeMonster (dead/alive), but really its looking at Player p1 (or p2's) activeMonster attribute. maybe i DO want to name p1/p2 as activePlayer/nonActivePlayer in Game class, that way I can refer to activePlayer and nonActivePlayer in the Game methods rather than having to check if p1 or p2 is activePlayer in my Game methods..... or.... can i do something like this: Game class Player p1 Player p2 Player activePlayer Player nonActivePlayer startGame->p1.setActive() initialSelection() activePlayer-> doThis p2.setActive() p1.setNonActive() etc OK what I'm doing for now is removing objects Player p1 and Player p2 and replacing them with Player activePlayer and Player nonActivePlayer. the reason for this is because we can set p1 as activePlayer from the get-go so don't need to start off calling it p1. I've added setActive(): int to the Player class so we can go nonActivePlayer.setActive and activePlayer.setInactive (guess i should add setInactive() too) now the last question is.... and i think i may have solved my confusion, we can write: initialSelection(Player): int selectMonster(Player): int etc and that's fine - it only feels wrong coz in Game we are naming our indivudal player objects whereas comparitively in Player we have written our Monsters as an array so just refer to them as Monster (rather than , say monster1, monster2) the confusion now , i guess, is that in the Game methods we are going to be passing in TWO objects (i think). do i write this as initialSelection(Player, Player): int? i guess not coz we're dealing with classes not objects. but when i comes to code it i guesss ill be passing in 2 of them... s so..this is what i end up with.. :/ ![[image loading]](http://i.imgur.com/joUNyP0.jpg) do i really need all those (Player) bits in the Game functions? OK I phoned someone and he suggested that I make Player activePlayer and Player nonActivePlayer into a Player[2] array (same as how I have my Monsters). Array will allow me to quickly/cleanly search thru the 2 players and pick out which one is isActive (originally activePlayer) and interact with it. This solves my worry of messing around with if statements (if p1 is p1.isactive else if p2 is p2.isactive...) Brilliant!
Okay, a few questions: First and most important one: For how long have you been programming?
Then on to the rest...
Are you programming in a language that doesn't have booleans?
Why are you calling getters for return?
Why are all your returnName methods returning an int?
Why are the two attributes isChosen / isDead not booleans in your Monster class? Why is Monster.returnIsDead() returning a string? Why is Monster.useAbility(int) returning an int?
Why doesn't Player.addMonster() accept something to add - and why does it return an int? Why is Player.setActiveMonster() returning an int? Why is Player.setActivePlayer() returning an int?
Why is every method in your Game class returning an int? Why is every method in your Game class taking a player as argument?
|
I've just updated to Internet Explorer 11. Guess what? It has a tick by default to update IE automatically. Still ok and you didn't get reminded of NSA? Well, that option is displayed on the "About" menu for some reason. Why would you do that? It's so unnatural and suspicious to be there. It's like they try to hide it as much as possible.
|
On November 16 2013 08:58 darkness wrote: I've just updated to Internet Explorer 11. Guess what? It has a tick by default to update IE automatically. Still ok and you didn't get reminded of NSA? Well, that option is displayed on the "About" menu for some reason. Why would you do that? It's so unnatural and suspicious to be there. It's like they try to hide it as much as possible. About: Firefox and Chrome both also house the update on the About option on top of update settings being available. Unless you're saying there's a warning about the NSA on there and then I find that mildly humorous but at least they're keeping it real.
|
On November 16 2013 09:24 ObviousOne wrote:Show nested quote +On November 16 2013 08:58 darkness wrote: I've just updated to Internet Explorer 11. Guess what? It has a tick by default to update IE automatically. Still ok and you didn't get reminded of NSA? Well, that option is displayed on the "About" menu for some reason. Why would you do that? It's so unnatural and suspicious to be there. It's like they try to hide it as much as possible. About: Firefox and Chrome both also house the update on the About option on top of update settings being available. Unless you're saying there's a warning about the NSA on there and then I find that mildly humorous but at least they're keeping it real.
Why would you put auto updates on the "About" menu from a design perspective? This should go to "Options" or "Preferences" menu instead because IT IS an option. Having updates is not about software. About should purely show version, company name, etc. That kind of information. Also I don't find it humorous because it looks like some semi-legitimate "backdoor" to update whenever they want without the user noticing that software actually has such an option enabled by default on some rarely visited and counter-intuitive menu item.
|
On November 16 2013 09:45 darkness wrote:Show nested quote +On November 16 2013 09:24 ObviousOne wrote:On November 16 2013 08:58 darkness wrote: I've just updated to Internet Explorer 11. Guess what? It has a tick by default to update IE automatically. Still ok and you didn't get reminded of NSA? Well, that option is displayed on the "About" menu for some reason. Why would you do that? It's so unnatural and suspicious to be there. It's like they try to hide it as much as possible. About: Firefox and Chrome both also house the update on the About option on top of update settings being available. Unless you're saying there's a warning about the NSA on there and then I find that mildly humorous but at least they're keeping it real. Why would you put auto updates on the "About" menu from a design perspective? This should go to "Options" or "Preferences" menu instead because IT IS an option. Having updates is not about software. About should purely show version, company name, etc. That kind of information. Also I don't find it humorous because it looks like some semi-legitimate "backdoor" to update whenever they want without the user noticing software actually has such an option enabled by default on some rarely visited and counter-intuitive menu item.  About is there to show your version so it seems intuitive to someone. And I just want to agree, Chrome and FF have been doing this forever.
|
On November 16 2013 09:48 obesechicken13 wrote:Show nested quote +On November 16 2013 09:45 darkness wrote:On November 16 2013 09:24 ObviousOne wrote:On November 16 2013 08:58 darkness wrote: I've just updated to Internet Explorer 11. Guess what? It has a tick by default to update IE automatically. Still ok and you didn't get reminded of NSA? Well, that option is displayed on the "About" menu for some reason. Why would you do that? It's so unnatural and suspicious to be there. It's like they try to hide it as much as possible. About: Firefox and Chrome both also house the update on the About option on top of update settings being available. Unless you're saying there's a warning about the NSA on there and then I find that mildly humorous but at least they're keeping it real. Why would you put auto updates on the "About" menu from a design perspective? This should go to "Options" or "Preferences" menu instead because IT IS an option. Having updates is not about software. About should purely show version, company name, etc. That kind of information. Also I don't find it humorous because it looks like some semi-legitimate "backdoor" to update whenever they want without the user noticing software actually has such an option enabled by default on some rarely visited and counter-intuitive menu item.  About is there to show your version so it seems intuitive to someone. And I just want to agree, Chrome and FF have been doing this forever.
On the other hand, Skype has a different menu item to show "About" and a different menu item to check for updates. And if you actually go to options, there is a tab to turn on/off updates. I'm not saying all software should be the same. It's just best practice in my opinion.
|
its because the engineers determined that the about page was a good place to put that as a visible option. From a design perspective I can see why streamlining that menu into a more "about the software/what version/check for and update if your version is older" idea works. I actually like that quite a bit, even though it is a secondary place for that option to be accessed from the more traditional "options".
|
Oh right. You're afraid of NSA because IE auto updates?
So you're not afraid of the exploits that they can find in older versions of IE?
|
|
|
|
|
|