Advertisement
Nickname
matt
Registered since:
February 6, 2002
Short bio:
Matt began his professional life as an electronic engineer but quickly saw the light and switched to software development. He now has more than 14 years professional software development under his belt, including work in C++, Java, Python, C# and mo
Home page:
http://www.cyclethere.com
Total posts:
1153

Forum posts by Matt Gerrans:

77 pages [ Previous 1 ... 31 32 33 34 35 36 37 38 39 40 41 Next ]
Posted in Java Answers Forum, Jul 3, 2003, 11:36 AM
You can't really "force" garbage collection, you can only "suggest" that it take place.Is it possible that you have other references to these objects in other places than just the Vector?If you are doing a lot of removing from the beginning of your list, a LinkedList might be a better choice than a Vector.
Posted in News & Ideas Forum (Closed for new topic posts), Jul 2, 2003, 12:30 AM
> I wrote the following toy Fibonacci function in Python and> Java:> > [pre]def fib(i):> if i == 0:> return 0> if i == 1:> return 1> return fib(i-1) + fib(i-2)> > x = 0> while True:> print x, fib(x)> x += 1> > At about 35, it's on the order of minutes to complete the> calculation. With Java, it doesn't slow down to that> point til about 41 or...
Posted in Weblogs Forum, Jul 1, 2003, 11:10 PM
> Some arose from dire circumstances against impossible odds.Hmm... I would imagine it is impossible to rise against "impossible odds." Otherwise the odds were not impossible, now were they?
Posted in Java Answers Forum, Jun 26, 2003, 12:06 PM
Maybe you are counting the '\r' part of a '\r\n' sequence at the end of the line?Also, along the lines of the last suggestion, you could also collect the results for each category and show not just the count, but also the characters that are comprise it. That is your output might be something like: There were 3 lowercase characters: 'a', 's',...
Posted in Java Answers Forum, Jun 26, 2003, 11:58 AM
The Java language is a relatively small thing to learn in comparison to the APIs, especially if you already have a good grasp on a similar language. It is good to always have the API reference handy, so you may want to download that: http://java.sun.com/j2se/1.4.1/download.htmlAs for learning a subject quickly, I think the CodeNotes...
Posted in Java Answers Forum, Jun 22, 2003, 11:28 PM
Look at the NumberFormat and DecimalFormat classes. I haven't fooled with these much, but I think you may need to cast the NumberFormat object you get from getInstance() to a DecimalFormat if you want to preserve locale-specific information.Here's a simple example of just DecimalFormat alone:System.out.println( new...
Posted in Weblogs Forum, Jun 22, 2003, 9:06 AM
I used to use such a script I wrote (with that exact same name!), but I recently got around to figuring out how to get my editors to start a new file, based on a template and that is even more convenient. Actually, for one editor I often use, EmEditor, it is nearly a no-op: just put template.py in EmEditor's home directory.By the way, why not...
Posted in Java Answers Forum, Jun 19, 2003, 4:42 PM
Did you get your question mark in the wrong place? Maybe you meant this:Why should object oriented software development be used? To reduce costs.
Posted in Weblogs Forum, Jun 18, 2003, 10:24 AM
> These are all things that require you to think about> bytes, and they affect the big top-level decisions we make> in all kinds of architecture and strategy. This is why my> view of teaching is that first year CS students need to> start at the basics, using C and building their way up> from the CPU. I am actually physically disgusted that so>...
Posted in Weblogs Forum, Jun 17, 2003, 5:28 PM
I haven't used BlueJ much, but I think it has some of the same problems you pointed out with JBuilder for beginners. Several times in the Java Answers Forum, I've tried to answer questions for students, but had troubles because their code was all wound up in BlueJ -- that is, it wouldn't compile without first having some BlueJ jar files...
Posted in C# Answers Forum, Jun 17, 2003, 2:30 PM
This doesn't have anything to do with C#, but it looks like you have too many closing braces.int main () { char myarray[10]; try { for (int n=0; n{ if(n>9) throw "Out of range"; myarray[n]='z'; } } catch (char * str) { cout "Exception: " } return 0;   } 's this???   }
Posted in Java Answers Forum, Jun 17, 2003, 12:49 AM
From looking at the documentation of toArray(object[]) in the Collection interface, you will want to return an array of Objects which match the type of the array passed in. That means if you have a heterogeneous collection of objects, only those which match that type should be returned in the array. You will probably use instanceof to determine...
Posted in C# Answers Forum, Jun 14, 2003, 4:58 PM
You didn't give the line number for the compiler error and the code you have posted here seems to be okay, so the error maybe coming from some other part of your code.FYI, here are some tricks that might help you with your app: You can use the DirectoryInfo object (you need to import System.IO, or fully reference it as System.IO.DirectoryInfo)...
Posted in C# Answers Forum, Jun 10, 2003, 3:05 PM
How's this?public static int minimum( int i, int j, int k ) { return i } Probably not the most readable or flexible solution!This is probably better:public static int minimum( params int [] numbers ) { int lowest = int.MaxValue; foreach( int i in numbers ) if( i return lowest; } This one allows you to pass any number of ints, or an array of...
Posted in News & Ideas Forum (Closed for new topic posts), Jun 4, 2003, 3:23 PM
> > This is probably an even better and a little more> > modernized version of the above:> >> > for line in file( filename ):> > ProcessTheLine( line )> > Actually, Bruce suggested I change it to the more modern> idiom, and I did. So now the article uses the file()> idiom, not the open() one.It wasn't just replacing open() with file() that I...
77 pages [ Previous 1 ... 31 32 33 34 35 36 37 38 39 40 41 Next ]
Advertisement