|
DholmbladRU posted:However I want to implement this without the use of arrays. Uh what? Why??
|
# ¿ Mar 23, 2011 03:10 |
|
|
# ¿ May 9, 2024 03:29 |
|
Kamakaze9 posted:
Seeing accounts[k].getId() makes me skin crawl. Never let this kind of statement sit out in production, even if you're "pretty sure" you know what k will be. It should be something like code:
code:
epswing fucked around with this message at 14:43 on Mar 24, 2011 |
# ¿ Mar 24, 2011 14:38 |
|
DholmbladRU posted:example of files I created to test Edit in an example output file, based on your example input files.
|
# ¿ Mar 24, 2011 18:14 |
|
Congrats, your software just crashed in production!
|
# ¿ Mar 24, 2011 18:43 |
|
Oh please, you can say that about any exception ever. The point is to cut down on cases where they are more likely to occur. I don't obsessively null-check every possible reference, but array[number].method() scares me. Am I really sure that (A) the array contains what I think it does, (B) the index is in bounds, and (C) the index is pointing to the object I want? Ok, I'm "pretty sure," but there are several things that can go wrong here. I'm just protected myself from myself. vvv Edit: The -1 was just an example for his toy homework assignment. Maybe a bad one. Yeah. Also, null may very well be a valid state. Also, time to read more about assertions, thanks. epswing fucked around with this message at 20:28 on Mar 24, 2011 |
# ¿ Mar 24, 2011 19:06 |
|
Jabor posted:You could, you know, check for null when you put something into the array. If you're inserting nulls into the array when they shouldn't be, your software is broken and you should crash instead of loving up important data by pretending everything's just dandy. Once your software is in a hosed-up state, crashing is better than most of the alternatives. Who says I put anything into the array? Maybe I was passed the array from some part of the program that some other guy in my company wrote. Or from some dll written by some other guy in some other company. What world do you live in where you magically know everything about the data you're receiving? Look, all I'm saying is seeing array[number].method() while iterating makes me take a closer look. epswing fucked around with this message at 15:35 on Mar 25, 2011 |
# ¿ Mar 25, 2011 15:07 |
|
Geekner posted:Also, you will not be proficient in Java after this That's an understatement... http://norvig.com/21-days.html
|
# ¿ Apr 7, 2011 14:37 |
|
Jam2 posted:I am (learning on the side) and I do (have the motivation). If it weren't for my 150% college course load and research obligations, I would spend every waking minute solving Euler problems and writing programs. I had an extra credit assignment for a Calculus class. I used logmein to write a monte carlo simulation from my iphone. It ran on the first try. I actually didn't even know it was called a monte carlo simulation until my professor graded it and gave me feedback. I'm a complete newb, but programming comes naturally to me and I really enjoy doing it. I want to do this for a living, so all of these plans are being made with this goal in mind. Ahh you'll be fine. People love to look back and chuckle from their ivory towers about how hard it was to get where they are now. They're not wrong, but I wouldn't fret, they did it and so can you. I think you're only mistake here was using the word "completely" which you've already understood and retracted. To me, a couple of the key attributes of a worthwhile programmer are intelligence and curiosity, and from across the internet it seems you might have both, so keep at it and have fun.
|
# ¿ Apr 8, 2011 14:16 |
|
tef posted:I'd say that the following are more important: Sure, I'll agree that attitude is also a key attribute, but I don't necessarily think it's "more important than" intelligence or curiosity. If any of these three are lacking, you're not going to get very far. vvv Edit: Yep, I was just referring to tef's post above (which I just quoted now) epswing fucked around with this message at 19:17 on Apr 8, 2011 |
# ¿ Apr 8, 2011 18:03 |
|
tef posted:actually no matter how smart you are or curious, if you're a dick to people, and can't write for poo poo, you won't get far. real software is written by groups, collaborating. What did I just say. If you're lacking in any of those, you're not going to get far. I can obviously come back with "it doesn't matter how great your attitude is, if you're not intelligent and curious, you won't get far." So I'm not sure why you posted.
|
# ¿ Apr 9, 2011 18:27 |
|
So because I'm saying that a worthwhile programmer should have intelligence and curiosity on par with attitude, I have a childish naive view of programming? Sorry but you're probably one of those dicks you were talking about earlier.
|
# ¿ Apr 10, 2011 17:29 |
|
tef posted:Programmers are frequently arrogant jerks. Not in my experience... tef posted:Simply put the idea that a career (in java) Who said anything about java. We happen to be in the java thread, but I haven't based anything I've written on that language. epswing fucked around with this message at 17:45 on Apr 10, 2011 |
# ¿ Apr 10, 2011 17:40 |
|
TheFatController posted:For I want to store the request body as an xml object Grab jdom and jaxen, put them on the classpath, and go to town. code:
pre:<root>here's some text</root> epswing fucked around with this message at 03:45 on Apr 20, 2011 |
# ¿ Apr 20, 2011 03:41 |
|
TaintedBalance posted:
Can you explain what you're trying to do here?
|
# ¿ Apr 21, 2011 17:21 |
|
Don't ask to ask, just ask! You'll either be ridiculed or aided or both. It's on the internet, what do you have to lose, really.
|
# ¿ May 3, 2011 14:21 |
|
Hidden Under a Hat posted:What's the best way to keep track of elapsed time in a loop while still reading a constant inputstream of data? The loop reading from the device isn't where you want to keep track of time. You don't have control over how often readLine returns. I would create two threads. One constantly loops over the output of the device, the other counts to 10, tells the first thread to gather data for a while, passes it to the ui thread for display, and counts to 10 again. pseudocode: code:
code:
|
# ¿ May 11, 2011 14:35 |
|
This should be some sort of UI benchmark. How hard (easy?) is it to append to the bottom of some UI control like a multiline textarea, listbox, datagrid, table, etc, and automatically scroll to the bottom. I've run into this problem several times in several languages and it's infuriating
|
# ¿ May 28, 2011 05:05 |
|
crazyfish posted:Of course you'll probably have to handle the case where fc.close() throws an exception too but I don't feel like writing that out. I usually write some sort of static 'silent close' method like... code:
code:
|
# ¿ Jun 13, 2011 17:52 |
|
Thermopyle posted:What is this called? varargs
|
# ¿ Jun 13, 2011 20:01 |
|
Ulio posted:Ok thanks I got it after this. Success! Although the readability of your code needs some work. Readability is very important, even though it looks like it doesn't matter in this small example. When you've written a larger program, and you want someone else to read/debug it, it helps immensely if all your brackets and indented code lines up nicely. Like this: code:
code:
code:
epswing fucked around with this message at 04:47 on Jun 30, 2011 |
# ¿ Jun 30, 2011 02:33 |
|
Ranma posted:if(numbers.length < 0) I haven't written java in a while, but I'm pretty sure this is wrong. epswing fucked around with this message at 19:16 on Jul 5, 2011 |
# ¿ Jul 5, 2011 18:42 |
|
Jam2 posted:Harvard CTO, Jim Waldo is coming in to speak to my intro java class tomorrow. He was on the team that developed the Java programming language at Sun back in the day. So what did you ask?
|
# ¿ Jul 22, 2011 01:11 |
|
Blacknose posted:I didn't know if there was a way to attach formatting data to a double without using a string. The client is almost certainly going to want a numeric value with formatting which as far as I can tell just isn't possible. I don't think you're getting it. To "attach formatting data to a double" is senseless. You can round the value, or floor/ceil it, but numbers don't have "formats". Strings do, though, so when you print your double, you can say "print two decimal places" so it looks like what you want. If you want some way of keeping this information "with" the double, you could make a little class... code:
|
# ¿ Aug 3, 2011 14:13 |
|
For your particular situation what would have been your alternative?
|
# ¿ Sep 7, 2011 03:59 |
|
Yep. JDOM!
|
# ¿ Sep 9, 2011 20:16 |
|
|
# ¿ May 9, 2024 03:29 |
|
What do you mean by "doesn't work"? What specifically isn't working? What are you expecting to see in that screenshot that you aren't seeing?
|
# ¿ Oct 4, 2011 06:03 |