Advertisement
Nickname
vincent
Registered since:
November 13, 2002
Short bio:
Software analyst / programmer / designer / developer (whatever you want to call it) for about 20 years.
Home page:
 
Total posts:
724

Forum posts by Vincent O'Sullivan:

49 pages [ Previous 1 ... 34 35 36 37 38 39 40 41 42 43 44 Next ]
Posted in Java Answers Forum, Mar 22, 2004, 1:32 PM
> I would make a utility method as follows: > :> And call this method with:> :> Note that we have separated the trimming from the> left-most functionality, so we can easily remove the> trimming when it's not needed anymore.I've already coded a similar leftmost(String s, int n) method into my app and call it from a number of places. I'd take...
Posted in Java Answers Forum, Mar 16, 2004, 6:21 PM
> don't you usually create a war by shooting some guns at> someone else?Such as the messenger?
Posted in Java Answers Forum, Mar 16, 2004, 10:59 AM
> Or since all the variables are references(except the> primitives) you can have out param in the calling> parameter list.You could do that but it would be an extraordinarily Bad Thing. I can't think of any reason I would allow such code to be delivered.Vince.
Posted in Java Answers Forum, Mar 15, 2004, 5:08 PM
You're right. I shouldn't have used such lngg.
Posted in Java Answers Forum, Mar 15, 2004, 1:09 PM
> Thanks all. I tried both solution with my Eclipse. Why i> have an compilation error if the class Sundae makeSundae> is not a static class???I think David has already answered this, above. If a method is not static then it can only be called via an instance of the class. For example:Sundae s2 = s1.makeSundae(); This means that you need an...
Posted in Java Answers Forum, Mar 13, 2004, 7:25 PM
rd th fg dcmtn?
Posted in Java Answers Forum, Mar 11, 2004, 10:31 AM
I knew Python would have it sussed but I couldn't be bothered to get my Python book out and see what it does. (Does it work if s is null, too. I did start learning the language last year but found that it was the straw that broke the camel's back when also trying to get my head simultaneously around more advanced Java, EJBs, Weblogic servers,...
Posted in Java Answers Forum, Mar 10, 2004, 9:33 PM
> Can you make this into a method? Do you have to do> everyting in one line?I already have:private String leftmost(String s, int n) { return s == null ? "" : s.trim().substring(0, Math.min(s.trim().length(), n)); } But it doesn't get around the fact that it's an ugly bit of code for something so simple. In VB, the equivalent code would be:...
Posted in Java Answers Forum, Mar 10, 2004, 2:42 PM
Version 3. Ugliest yet! Also failed if newValue was null...this.value = newValue == null ? "" : newValue.trim().substring(0,Math.min(newValue.trim().length(), 3)); Vince.
Posted in Java Answers Forum, Mar 10, 2004, 1:51 PM
> > ugly): > > this.value = newValue.trim().substring(0, > > Math.min(newValue.length(), 3)); Is there a> > simpler/more elegant single line solution that I have> > missed?> > > > Vince.> > Yours is essentially the same solution that I would have> come up with. It will be interesting to see if anyone> else comes up with something significantly...
Posted in Java Answers Forum, Mar 10, 2004, 1:16 PM
I have a method which is passed a String of arbitary length. I need to store the leftmost three characters. Unfortunately, the String's substring method throws an error if I ask from three characters from a shorter String, so I have come up with the following (which seems somewhat ugly): this.value = newValue.trim().substring(0,...
Posted in Java Answers Forum, Mar 3, 2004, 12:47 PM
> > Two questions (one rhetorical):> > 1) Why doesn't everyone accept ISO format date> strings?> Legacy, and because of the many regional differences.> Also, many endusers aren't aware of the fact they should> use nice ISO standardised date formats and will type in> any garbage and expect the software to understand it.Ah I agree entirely,...
Posted in Java Answers Forum, Mar 3, 2004, 10:53 AM
I've just written a wee method that parses a date string in ISO format ("YYYY-MM-DD HH:MM:SS.S") into a local format ("DDMONYYYY"), e.g. "2004-03-04 10:45:17.2" to "04MAR2004".Two questions (one rhetorical):1) Why doesn't everyone accept ISO format date strings?2) Do the java libraries already contain a suitable parsing/conversion method for...
Posted in Weblogs Forum, Mar 1, 2004, 10:39 AM
> I'm not sure whether this fit's Dave's philosophy but "One> Assertion Per Test" doesn't mean it has to be one of> JUnit's own assertions.This sounds like a sensible position. The only problem is that you now identified a point of confusion in that the verb "to assert" is being used within the same domain by different people to describe two...
Posted in Weblogs Forum, Feb 24, 2004, 9:42 PM
Whilst refactoring the example above may be easy, refactoring isn't an end in itself but a mechanism for reaching another end. At the moment there is no reason to modify this code other than because "it is crap" and that, in itself, just isn't enough. There are bigger fish to fry.The seminar idea is good, worth some consideration for this...
49 pages [ Previous 1 ... 34 35 36 37 38 39 40 41 42 43 44 Next ]
Advertisement