Search results

  1. X

    Preperation for College

    [Lethal] > IQ can only get you so far in life. That's funny; I always thought that the take-home lesson was that a high-enough IQ trumps just about every other shortcoming. I mean, it's not like STL's blind zealotry or social indelicacy held him back in the real world; Microsoft recruited him...
  2. X

    Preperation for College

    The personal site of STL might interest you. He was the valedictorian of his class and had some amazing test scores: # SAT I: 1600/1600 (sophomore year), 1480 (freshman year; 730 math, 750 verbal) # ACT: 35/36 (late junior year), 34 (early junior year), 31 (freshman year) # SAT II Math IIc...
  3. X

    anyone good at recursion stuff v.c++

    I came up with a very succinct, recursive solution that solves the problem in O(n). I'll give you some hints about the function I wrote. Its signature (in Java) is: public static int maxSequenceLen(int[] array, int begIdx) For the example array you gave, the function is called 8 times and...
  4. X

    Z-5500 speaker cable confusion

    Hi, I was looking at the Z-5500 on Newegg and I found 2 different speaker wiring designs: In the top image, the speaker cables are hard-wired to the speakers and they plug into RCA-style input plugs on the subwoofer. In the bottom image, the speaker cables are not hard-wired and the...
  5. X

    intel X25M G2 - $249.00 In stock at MWave @ 2:05PM MST

    Hot damn, thanks for the find! I ordered two of them with 2 day shipping for $509.41. Also, this deal is most definitely [H]ot, considering that demand for these drives has driven up their price at Amazon (the only other retailer that seems to have them in stock right now) to $329.99. Even...
  6. X

    Where to Buy 920 D0 Stepping?
  7. X

    Programming - Learn First?

    To add to mikeblas's explanation, many programmers assume that garbage collected languages like Java and C# can never leak memory. That's not true! Consider this example from Effective Java, 2nd Ed.: // Can you spot the "memory leak"? public class Stack { private Object[] elements...
  8. X

    Java code: Limiting float values to 2 points past decimal.

    You want printf. Here's some example code: float value = 1234.56789f; System.out.printf("%.2f", value); // Prints "1234.57" Incidentally, there's an expression in your code that's just begging for trouble: acreage = (length * width) / 43560; Since all values in the expression are...
  9. X

    Visual c++ vs c++

    [CreganTur] > I can't speak on building visual applications via C++. > I imagine it can be done, but would take a lot of work. I don't think you can use Visual C++'s spiffy GUI builder to create an unmangaged C++ GUI. You can use Qt's though, which is also very good.
  10. X

    java project works fine in netbeans but not from cmd prompt

    Netbeans has that feature, except they call it "live parsing". Any time the background compiler detects an error, it underlines the offending line in red. In the margin at the left of the line, a light bulb icon appears that you can click to pop up a list of suggestions to fix the problem...
  11. X

    java project works fine in netbeans but not from cmd prompt

    Netbeans vs Eclipse is like vi vs Emacs: both are good, it just comes down to personal preference. Besides, most Netbeans detractors haven't tried a recent version. Its editor used to be clearly inferior to Eclipse's. Now it's not.
  12. X

    C++ Linked List problem

    In a singly-linked list, I can't see a way to do what you're asking with less than 4 pointers. In a doubly-linked list, on the other hand, you could get by with 2. EDIT: Scratch that; I figured out a way to remove the minimum element from a singly-linked list using only 2 pointers. The trick...
  13. X

    java project need assistance

    For what it's worth, the way to fix the code I suggested is: File jarFile = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()); I forgot that you structured your program in a goofy way such that all methods were static.
  14. X

    java project need assistance

    [King_Weaver] > I need it to always save the file in the same directory as the .jar file Believe it or not, what you're asking is very difficult to do in pure java. There's a thread about it on the Sun forums: It seems...
  15. X

    java project need assistance

    From what directory are you running the program? "user.dir" will vary depending on what directory you're in on the command line when you invoke java.
  16. X

    java project need assistance

    It would help to know the relevant directory structure of your USB drive (i.e. where the JAR is relative to the root dir) and the exact method you're using to start your program (i.e. are you double-clicking the jar or running it from the command line). That said, I'm going to take a shot in the...
  17. X

    java project need assistance

    private static void readfile() throws IOException { FileReader studenttext = new FileReader("C:\\students.txt"); BufferedReader input = new BufferedReader(studenttext); } You have a local variable hiding a field in this function. Try: private static void readfile()...
  18. X

    java project need assistance

    To me, it doesn't look like your loop body ever even gets entered. Your invariant is: while (line != null) { but you allow line to be default initialized to null here: private static String ..., line, ...; Your loop invariant really ought to look something like: while ((line =...
  19. X

    java project need assistance

    Can you post more of the file that you're trying to parse? I can't tell if you have records for more than one person appearing on the same line. If so, things'll be trickier.
  20. X

    String Tokenizer Help

    [amromousa] > StringTokenizer is also deprecated, right? Nope, and for one important reason: it doesn't use regular expressions to tokenize input; it uses simple (literal) character matching. That may seem like a weakness, but regexs can be slow. If you're tokenizing a lot of input and your...
  21. X

    String Tokenizer Help

    The bigger problem is that your inner loop logic is almost certainly wrong. String dbRecord = loadUserDatabase.nextLine(); StringTokenizer dbRead = new StringTokenizer(dbRecord, ":"); for(int i=0;i<3;i++) { //Username credentials[0]= dbRead.nextToken(); //line 36...
  22. X

    Syntax and efficiency question

    "Premature optimization is the root of all evil" - Donald E. Knuth
  23. X

    Trouble sorting this array.

    I'm not sure if you're aware of it or not, but your code implements selection sort. Just FYI.
  24. X

    Binary Tree Help

    In a binary search, it's never necessary to examine both of the children of some node.
  25. X

    Way to archive a webpage?

    You might look into wget.
  26. X

    Interested in programming. What should I learn?

    The distinction you all are looking for between HTML and C/Python/Fortran/etc is Turing completeness. HTML is not Turing complete.
  27. X

    Another C++ Problem

    [TheJokerV] > I basically just put the iostrwam and namespace lines in the cpp file but > including it into the .h file would be better for my purposes. Never, ever put a "using" directive inside a header file at global scope. Ever. It's not a great idea to include stuff in a header that...
  28. X

    Another C++ Problem

    [TheJokerV] > But why would I need to do that if I already said using namespace std in the main file? "using" and "#include" declarations are not global; they only apply to individual translation units (read: .cpp files and their header dependencies). > Also that didn't work. You also need to...
  29. X

    Another C++ Problem

    cerr, endl, et al are defined in namespace std. So, in myvector.cpp, either add "using namespace std" to the top of the file, or prepend every usage of those items with "std::" .
  30. X

    recursion question

    [fluxion] > swap 2 lines, and re-arrange the ordering of one the lines. just like Xeno8 said in the 3rd post ;p Thanks, fluxion. :cool: onetwenty8k's solution is just as good as what I had in mind and even less verbose, but I liked the idea of making as few changes as possible to his...
  31. X

    recursion question

    You guys are really overcomplicating this. onetwenty8k, in printLetters, you emit output before you make a recursive function call. Try doing the opposite. Also, keep in mind the tip fluxion and I gave: > on everything >except< the last recursion, print the comma >before< > the character...
  32. X

    recursion question

    [mavalpha] > Wouldn't you have the same problem, but moved? Try calling printLetters somewhere else in the function.
  33. X

    recursion question

    [mikeblas] > you'll have to fix your code to print the comma conditionally instead of unconditionally. I disagree; his code in printLetters already prints commas conditionally. That is, if the length of str is N, he prints N - 1 commas, not N of them. With respect to my suggestion of modifying...
  34. X

    recursion question

    [onetwenty8k] > I kinda took a shortcut for the first problem Actually you didn't. Forgive me if I'm being maddeningly vague (I don't want to give up the answer too easily), but your printLetters method can be made to print in reverse by simply moving one line of code to a different place (but...
  35. X

    Java Help

    Seems like a goofy requirement that your answer should be exactly some pre-determined approximation of pi. As long as your algorithm converges to the true value, who cares? For shits and giggles, I tried: for (int i = 1; i <= 1000000; i += 2) { pi += 4 / (2.0*i - 1) - 4...
  36. X

    Problem with C++ Program

    sumi is declared as a double. Initialization means to assign a variable an initial value, e.g. double sumi = 0; You'll want to initialize all of your other variables in the same manner. Incidentally, your code does indeed compile without issue, but the variables that you didn't explicitly...
  37. X

    Your Top 3 PC games?

    I love how so many only grudgingly include WoW in their list. I guess too many people are angry at it for almost completely devouring a year of their life and seriously threatening their schooling or work. 1. WoW 2. Deus Ex (who else got really involved in its multi-player game?) 3...
  38. X

    C++ Education Advice

    I believe the C++ advocates would call that "multi-paradigm". There are precious few OOP practices that Java supports and that C++ does not. In fact, there are some features, like multiple inheritance, that are possible in C++ but not in Java.
  39. X

    Java Book

    It's tough to go wrong with The Java Programming Language, 4/e. It's (co-)authored by Gosling himself.
  40. X

    Got a question for a PC-V1000 Plus II owner.

    You might be better off with the PC-V1200 Plus II instead. It's the case I'm planning to use for my upcoming build. It's 10 cm longer than the PC-V1000, which means more space for the video card(s), PSU, and cables. Some of the reviews seem to indicate that there still may not be enough room...