|
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 February 22 2014 02:05 WarSame wrote: The key being for independent events. When they're dependent events(the state of one affects another) then it gets a bit trickier, and I don't really remember the rules. Generally, in that case I find drawing a Venn diagram helps keep track of the probabilities. Obviously when you get to 5 and above events it'll become impossible to draw.
EDIT: Oh, hey, 1000 posts. Cool.
You just have to subtract the union. The probability of x or y happening is P(X) + P(Y) - P(XY). This works because you're counting the chance of XY happening in the probability of X and again in probability of Y so subtracting it out once leaves you the correct answer. If you have more events it gets more complicated but follows a similar pattern. Say you want to know the probability of X or Y or Z happening.
P(X) + P(Y) + P(Z) - P(XY) - P(YZ) - P(XZ) + P(XYZ)
The same pattern extends if you add more events (add odd combinations of events and subtract even combinations of events).
|
United States10328 Posts
On February 22 2014 04:18 Blitzkrieg0 wrote:Show nested quote +On February 22 2014 02:05 WarSame wrote: The key being for independent events. When they're dependent events(the state of one affects another) then it gets a bit trickier, and I don't really remember the rules. Generally, in that case I find drawing a Venn diagram helps keep track of the probabilities. Obviously when you get to 5 and above events it'll become impossible to draw.
EDIT: Oh, hey, 1000 posts. Cool. You just have to subtract the union. The probability of x or y happening is P(X) + P(Y) - P(XY). This works because you're counting the chance of XY happening in the probability of X and again in probability of Y so subtracting it out once leaves you the correct answer. If you have more events it gets more complicated but follows a similar pattern. Say you want to know the probability of X or Y or Z happening. P(X) + P(Y) + P(Z) - P(XY) - P(YZ) - P(XZ) + P(XYZ)
The same pattern extends if you add more events (add odd combinations of events and subtract even combinations of events).
I think both thinking about it logically (like you said) and drawing a Venn diagram (like WarSame said) are really helpful for understanding inclusion-exclusion.
|
On February 22 2014 04:04 darkness wrote:Show nested quote +On February 22 2014 04:00 Arnstein wrote: I'm a second year student in cybernetics, and I got a summer internship with ARM this summer!!! Sooo happy! Never thought I would get the job as the other people were in the 3rd and 4th year. What questions have you been asked?
I will ask if I am allowed to share that. Let's just say that I was shocked at how big the task was, since I only got one hour to finish it.
|
You guys are right. Thanks. I do somewhat remember that from my Stats/Discrete math.
|
Java question.
I am a bit stuck on my Sudoku project. I want to offer a feature to have a puzzle (chosen from a list by difficulty) to be modified at run time by the user. I use the MVC architecture. The puzzle is on an ArrayList, but I also have file access to puzzles. The problem is I don't know how to do that. Should I show a (modal?) dialog with a puzzle with the same functionality (except the timer) that you see on the screenshot? Even so, is it possible to customise a dialog like that? I just don't know where to start form. Not using any dialog, and cancelling the current game to allow modification doesn't seem too flexible and nice to me as an option.
Hopefully you get the idea. Just throw at me topics or something so I can start reading.
|
What do you mean by modify here? Do you want people to be able to change difficulty, fill in the squares, add notes or something else?
If you mean when they change difficulty, then it makes sense to give them/make a new puzzle of the given difficulty. If you want to keep the same one but make it easier, maybe just have the program show the actual value for one square.
|
On February 22 2014 07:55 DeltaX wrote: What do you mean by modify here? Do you want people to be able to change difficulty, fill in the squares, add notes or something else?
If you mean when they change difficulty, then it makes sense to give them/make a new puzzle of the given difficulty. If you want to keep the same one but make it easier, maybe just have the program show the actual value for one square.
By modification I mean changing difficulty and/or filling in squares or removing values from them. Up to the user.
Edit: I've figured it out. Just JOptionPane with a JPanel as one of the arguments.
|
I'm in kind of a tricky situation and could use any help that's possible. I'm working on a project for a class in a group of 5. One aspect of this project is to develop an Android app that can communicate with a Bluetooth module. However, there is one big problem: None of the members in my group has any experience with either Android programming or Bluetooth communication. Therefore, we have to pick this up on the go. These past few days, I've been working on familiarizing myself with Android programming, and I can now build some very simple apps. I have also gotten our Bluetooth module to send information to an Android device (verified using the ArduDroid app). What I'm now struggling with is designing my own app that can receive this information.
I've been trying to follow the Bluetooth tutorial on the Android website, and I've made some small progress there. I can now check if the Android device has Bluetooth capability, and enable it if it is disabled. However, now I am stuck. I don't know how to go about pairing up with/connecting to the Bluetooth module. I would appreciate any help here.
EDIT: I can pair Android and the module together in the Android's Bluetooth settings, so I don't have to do that in the code. However, connecting them is still going over my head.
|
On February 24 2014 06:05 Beamer wrote:I'm in kind of a tricky situation and could use any help that's possible. I'm working on a project for a class in a group of 5. One aspect of this project is to develop an Android app that can communicate with a Bluetooth module. However, there is one big problem: None of the members in my group has any experience with either Android programming or Bluetooth communication. Therefore, we have to pick this up on the go. These past few days, I've been working on familiarizing myself with Android programming, and I can now build some very simple apps. I have also gotten our Bluetooth module to send information to an Android device (verified using the ArduDroid app). What I'm now struggling with is designing my own app that can receive this information. I've been trying to follow the Bluetooth tutorial on the Android website, and I've made some small progress there. I can now check if the Android device has Bluetooth capability, and enable it if it is disabled. However, now I am stuck. I don't know how to go about pairing up with/connecting to the Bluetooth module. I would appreciate any help here. EDIT: I can pair Android and the module together in the Android's Bluetooth settings, so I don't have to do that in the code. However, connecting them is still going over my head. I don't have a lot of experience with bluetooth in particular but I believe you can use BluetoothSocket or BluetoothServerSocket just as you would if you were using a TCP connection.
|
Finished some project, where I was coding the wordpress theme. Fairy easy, but there's on bug that's left on my list and I'm unsure how to fix that. This screen should help - overall, they're two backgrounds implemented on that page. One is the actual background, the second is the "torn paper" thing that appears on the edge of the main container. The problem is, that the "torn paper" thing is going a bit too far. Of course making any div longer, makes the page longer as well, so that's not the solution. I'm pretty sure this is something rather easy, but I'm still in weekend mood so my thinking is off a bit :F
|
Does anyone have experience hosting with GoDaddy? Because this thing is kinda fucking stupid.
|
What do you need GoDaddy for?
|
My company has a client that specifically asked to host their site there for whatever reason. I was put in charge of the move.
|
Do you guys find yourselves write sloppy (== quick) code on purpose just to implement a feature and make it work? After you're sure it works, you just refactor code to make it look better. I'm getting lazy these days, and I tend to have this bad habit. It probably doesn't save me time, but I certainly get a goal accomplished, especially if I'm initially uncertain how I should do implementation. I think it gives me the benefit to experiment code faster rather than spend time to write comments and connect objects properly.
|
Hyrule19167 Posts
I write sloppy and quick code to get a feature done and then I never refactor it because I've got far too many things to do.
|
Write the shittiest of shit code to do a prototype. If that's what you chose to go with, throw it all away and write it properly with comments and diagrams explaining the why and hows - it's the only proper way to do it, and you're fucking over yourself and all your future colleges by not doing it properly.
|
I usually write a rough idea how to do it properly in a comment. So if future me (or a poor guy) ever visits that code again he at least has a chance. Rarely, when it's a real mess and/or can be done way more elegant quickly, I refactor directly (see tofucake's answer) That said - I never "blindly" start writing anything, so I can at least avoid some shit.
Worst person though is private past me, since he always thinks that he can do cool stuff & get performance by doing bit/byte shit. I hate private past me whenever I look at his code. He also only rarely comments.
|
i usually write it as fast as i can to 'make it work' then 'make it better'
|
On February 25 2014 06:55 tofucake wrote: I write sloppy and quick code to get a feature done and then I never refactor it because I've got far too many things to do.
Do you feel confident that your quick code is good or do you just rely on compiler's optimisation?
Also a follow-up question to everyone: which book do you recommend for learning how to write good code? I've come across these 2 "Code Complete" and "Clean Code: A Handbook of Agile Software Craftsmanship". My level is neither beginner nor veteran, so something in between should be preferable.
|
I don't write sloppy code quick first because I don't have time. There's too much danger it won't get replaced/refactored quickly enough, and then the amount of time required to support it is too large.
|
|
|
|
|
|