|
Mulloy posted:You really need to post your code rather than referring to your "first class" and your "second class."
|
# ¿ Nov 24, 2009 06:22 |
|
|
# ¿ May 9, 2024 11:42 |
|
Does he have a really good reason why he isn't using Swing?
|
# ¿ Nov 27, 2009 17:56 |
|
I think you want the Javascript thread...
|
# ¿ Dec 1, 2009 18:46 |
|
I'd probably start by writing insertion sort myself from scratch, using an int[] as input, just to understand what's going on. You can use the algorithm described in http://en.wikipedia.org/wiki/Insertion_sort nearly line-for-line.code:
|
# ¿ Dec 10, 2009 06:52 |
|
mister_gosh posted:Is there a design patterns megathread? You tell me. http://forums.somethingawful.com/f/search
|
# ¿ Jan 21, 2010 00:58 |
|
Mustach posted:
Seconding this. That's majorly hosed. You should be encouraged to ask as many questions as necessary to understand the lesson/exercise.
|
# ¿ Jan 25, 2010 19:50 |
|
So just to clarify, your program is only given e as input, yes?
|
# ¿ Feb 1, 2010 17:47 |
|
Maybe the values he needs to find must all be integers.
|
# ¿ Feb 1, 2010 23:06 |
|
Assuming "lookup" means retrieving a value based on a key, does Map.Entry magically obtain a value without a lookup?
epswing fucked around with this message at 17:39 on Feb 4, 2010 |
# ¿ Feb 4, 2010 17:35 |
|
That was actually an interview question I gave recently, just to weed out the liars. Turns out about half couldn't do it. And about half of the ones that did couldn't do my next question, which was "same thing, recursively."
|
# ¿ Feb 7, 2010 18:39 |
|
fletcher posted:JFreeChart + data URI scheme = This is so you don't have to save the image to a web-accessible folder? You just send the contents as base64 and the browser renders it? Neato. Guess the downside is you have to generate the image every time, but I suppose that's fine if it changes often enough.
|
# ¿ Feb 13, 2010 00:28 |
|
The way you're thinking about it, you'd create them but wouldn't be able to use them (you wouldn't magically be able to utilize al1, al2, etc). You have to put them somewhere. If the number of lists you want to create is variable, use an ArrayList instead of an array (like Psychorider suggests):code:
|
# ¿ Feb 14, 2010 11:05 |
|
I remember getting a lot of mileage out of the Cajo Project (wikipedia link) when writing an internal client/server app. I suppose if your goal is to learn RMI, you should continue without the aid of such a framework, but as I recall Cajo made RMI much easier to deal with.
|
# ¿ Feb 16, 2010 17:56 |
|
Regarding java/tomcat web development, is the workflow still the same? Make changes, deploy/reload, refresh browser, repeat...until OutOfMemoryError: PermGen space, in which case shutdown (or even kill -9, if necessary), startup, repeat. I can hardly believe this issue, which affects everyone in the world who develops for the tomcat container, hasn't been solved yet. Edit: or has it? I heard tomcat 6.0.24 fixes this (by actively reaching into other libs and nulling references, killing off threads, etc), c/d? epswing fucked around with this message at 18:48 on Feb 19, 2010 |
# ¿ Feb 19, 2010 18:42 |
|
To "iterate" through a collection means to visit every element in a collection. You can iterate through the ints in an ArrayList<Integer>:code:
code:
code:
An ArrayList is backed by an array. You've got a linked list, so it's a different data structure underneath, but should be the same to work with. Start by pointing at the first element in the linked list, and i.hasNext() should return true and i.next() should return the first element and try to move to the second, and so on. epswing fucked around with this message at 03:01 on Mar 4, 2010 |
# ¿ Mar 4, 2010 02:51 |
|
Just a style gripe, but this:code:
code:
epswing fucked around with this message at 07:06 on Mar 9, 2010 |
# ¿ Mar 8, 2010 06:15 |
|
yatagan posted:Jumping on the style train, I prefer this way because I think it's easiest to parse reading someone else's code. Some people might lambast multiple points of return, but the reason that's undesirable is not applicable here. Sorry, I fail to see how this offers any readability advantages. You should be able to read simple boolean expressions, so "return A || B" should be very clear. You sound like you'd write something like... code:
If the expressions were getting particularly complex, you could do something like... code:
|
# ¿ Mar 9, 2010 09:12 |
|
The code you posted contained a boolean expression with ANDs/ORs/NOTs, so I'm not sure what you're arguing now. I wasn't griping about negations, I was squinting at multiple return statements.
|
# ¿ Mar 9, 2010 16:55 |
|
osama bin diesel posted:for what is worth I prefer yatagan's way of writing it but would of had a else so it lines up Agreed, I can more easily stomach it without the fall-through return statement. And for what it's worth, I'd read the following two statements aloud exactly the same way. 1. if (A || B) { return true; } else { return false; } 2. return (A || B);
|
# ¿ Mar 9, 2010 18:55 |
|
Exporting to jar shouldn't be too hard, eclipse can do that for you, you just specify the file with the main method you want to run. I think it's under File -> Export -> Export to JAR. Someone asked about RMI recently, if you look back a few pages in this thread you might find some good links.
|
# ¿ Mar 10, 2010 03:00 |
|
Stop using regex to parse xml. http://forums.somethingawful.com/showthread.php?threadid=2780384&pagenumber=51&perpage=40#post368046496
|
# ¿ Apr 6, 2010 15:39 |
|
code:
It's a one-liner Edit: On a more serious note, I personally find that creating a Pattern, giving it to a Matcher, and then iterating over groups to be particularly annoying considering how easy this is to do in other languages. I'm not sure why people flock to this error-prone method when XML is involved, considering just parsing the XML and selecting exactly what you want takes as much or maybe even less work. To each his own, I suppose. epswing fucked around with this message at 21:48 on Apr 6, 2010 |
# ¿ Apr 6, 2010 21:43 |
|
1337JiveTurkey posted:I'd say that 90% of my stress at work is from people ignoring established solutions to complex problems in favor of their own hacked together solutions Yes. I'd say this is closer to 60% of my stress at work. Unless I'm doing something that no one else in the world has ever done (hah), I'm a fan of following established solutions aka doing things The Right Way (tm) (r) (c). Software is too complicated, otherwise.
|
# ¿ Apr 7, 2010 06:13 |
|
I'm saying that regexing XML is error-prone. And I said using Pattern/Matcher is about the same amount of code as just parsing the XML, which you just demonstrated. I'm not sure how you missed the point, which was "use the right tool for the job." epswing fucked around with this message at 17:34 on Apr 7, 2010 |
# ¿ Apr 7, 2010 17:29 |
|
Threading: elevator simulator!
|
# ¿ Apr 11, 2010 16:33 |
|
It's a known fact that CNN speeds up Java (tm) (r) (c) programs.
|
# ¿ Apr 14, 2010 06:16 |
|
Not really. The second one lets you assign the StringBuilder based on arguments given to the constructor though, so maybe when you're constructing a Whatever you'd want to pass in an int to set the initial size of the StringBuilder. code:
|
# ¿ Apr 21, 2010 19:36 |
|
We do a fair bit of batch processing at work, I was wondering the same thing. We're looking for a framework that will allow us to distribute 'jobs' to waiting nodes. Communication has to be robust and reliable (no duplicate work done, no jobs lost due to exceptions/crashes). We're actually itching to do it ourselves (currently reading about JMS), if we have the time, but if something exists we'd love to evaluate it. Suggestions? vvv Sweet, thanks. epswing fucked around with this message at 05:14 on Apr 27, 2010 |
# ¿ Apr 27, 2010 02:51 |
|
Teeheecode:
code:
epswing fucked around with this message at 21:58 on May 4, 2010 |
# ¿ May 4, 2010 16:15 |
|
If you didn't notice the "Teehee," this was a comedy 'contains' option. vvv Edit: No problemo, and actually, thanks for the asymptotic analyzing, it's worse than I thought. epswing fucked around with this message at 22:02 on May 4, 2010 |
# ¿ May 4, 2010 21:47 |
|
If you've never done them, why do you think your opinion that they're a waste of money is worth anything? I'm not intentionally trying to be a dick, but saying something is a waste of money with zero backup isn't helpful to anyone.
|
# ¿ May 5, 2010 15:29 |
|
I have a textfile in my src folder, like jdbc.properties or whitelist.xml, and when I compile it ends up in my bin folder (or more specifically, my war/WEB-INF/classes folder since I'm in tomcat-land). How can I access whitelist.xml? I thought I'd done this before in a previous life (job), but now I think that was packaging images for JButton icons into a jar, which isn't the same thing. I think I used some System.something call for that, but I can't find it now, and I'm not sure what to search for. I can't reliably snatch whitelist.xml out of the filesystem, because when I start the tomcat server with tomcat/bin/startup.sh the current working directory is wherever I execute that command, obviously, so I can't get to it relatively, and trying to get to it absolutely is just dumb. Edit: speling vvv Edit 2: Gracias! epswing fucked around with this message at 20:23 on May 5, 2010 |
# ¿ May 5, 2010 19:55 |
|
nevermind...
|
# ¿ May 11, 2010 22:13 |
|
You could download and take a look at how pircbot does things.
epswing fucked around with this message at 05:35 on May 17, 2010 |
# ¿ May 17, 2010 00:46 |
|
This set of video tutorials is linked in the OP, check them out: http://sourceforge.net/projects/eclipsetutorial/files/ Edit: vvv No worries, let us know if they're any good. epswing fucked around with this message at 20:41 on May 18, 2010 |
# ¿ May 18, 2010 20:00 |
|
The OP posted:Also Bubblegum Wishes recommends this series of videos teaching Java from the ground up using Eclipse.
|
# ¿ May 27, 2010 02:55 |
|
yatagan posted:Here's a better way, remember which was last filled in by the user. I think I like yatagan's idea more, but another option is to have one "convert" button below each textfield. vvv Edit: even better epswing fucked around with this message at 14:38 on May 28, 2010 |
# ¿ May 28, 2010 12:43 |
|
mister_gosh said he's got two war files, so two web apps. Isn't MEAT TREAT's suggestion exactly what tomcat/lib is for (ie multiple webapps having access to the same set of jars)?
|
# ¿ May 28, 2010 19:07 |
|
Does tomcat override by filename or by what's inside the jar?
|
# ¿ May 28, 2010 19:40 |
|
|
# ¿ May 9, 2024 11:42 |
|
I'm writing about 100,000 lines to an HttpServletResponse:code:
I'm going to start playing with maybe setting the content length in advance, or trying different content types, but would you expect a response of this size to take 10 seconds? I don't think I'm bandwidth-limited, because we're only talking about 6mb / 10s = 600k/s here, and I'd expect to be able to hit a faster speed than that when everything is local.
|
# ¿ May 28, 2010 21:40 |