dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 3 of 3 FirstFirst 123
Results 31 to 41 of 41

Thread: How to "untrim" variable?

  1. #31
    Phil Weber Guest

    Re: How to "untrim" variable?

    > Go back and take a look at John K's original posted
    > code again...Do you really think he is ready to contem-
    > plate the finer points of code optimization?


    Rick: Go back and re-read our initial exchanges in this thread. I never said
    that you should not have suggested Format$ as a solution to John's problem.
    I merely pointed out that, compared to the other suggested solutions, it's
    extremely slow. I think information on the relative performance of various
    techniques is valuable, regardless of one's current level of expertise.
    Given five otherwise-equal solutions, how else can one (particularly a
    beginner) decide which one to use?

    Rather than simply acknowledge that Format$ is indeed the slowest of the
    suggested solutions and that John may want to use one of the other
    techniques if performance is an issue, you got defensive and turned this
    into a protracted argument.

    I'm done. You may have the last word.
    ---
    Phil Weber



  2. #32
    Brent Guest

    Re: How to "untrim" variable?


    Ummm... Oh yes! My Blonde moment for the day... forgive me I'm a bit under
    the weather today.

    "Phil Weber" <pweber@teleport.com> wrote:
    > > Missed an opportunity to explain the pros and
    > > cons of each solution.

    >
    >Brent: I thought I did explain the pros and cons of each solution. All the
    >suggested solutions work, but some work much more efficiently than others.

    I
    >posted timings earlier in the thread so that people who are interested in
    >writing efficient code can make an informed choice.
    >---
    >Phil Weber
    >
    >



  3. #33
    Rick Rothstein Guest

    Re: How to "untrim" variable?

    > Rather than simply acknowledge that Format$ is indeed the slowest
    > of the suggested solutions and that John may want to use one of the
    > other techniques if performance is an issue, you got defensive and
    > turned this into a protracted argument.



    I'm sorry for becoming defensive and forcing this thread to "live" longer
    than it should have. I think your 2nd comment to me, namely,

    "Rick: It should *always* be a race. Given two techniques that accomplish
    the same thing and are equally readable, why would one ever choose the
    slower one?"

    got me rolling along and the momentum seemed impossible to stop from there
    on out. This question seemed to "challenge" my offering the Format
    suggestion to John K in the first place and I thought it important for you
    to realize that their was a reason why I posted the solution. After that,
    one thing seemed to lead to another.

    Anyway, if I offended you (or others reading this thread), I do apologize.
    It was never my intention to become abrasive.

    Rick



  4. #34
    Audie F. Thomas Guest

    Re: How to "untrim" variable?

    Since I brought it up, does anyone know of good complete documentation on
    the syntax used in the Format function? The VB6 help on this is very
    incomplete.

    --
    Regards,
    Audie F. Thomas
    Audie Technology, Inc.
    sales@audietech.com



  5. #35
    Phil Weber Guest

    Re: How to "untrim" variable?

    > Since I brought it up, does anyone know of good complete
    > documentation on the syntax used in the Format function?
    > The VB6 help on this is very incomplete.


    Audie: I think it's all in there, you just have to follow all of the "See
    Also" links from the help topic on the Format function itself. The following
    links are especially informative:

    Named Date/Time Formats
    Named Numeric Formats
    User-Defined Date/Time Formats
    User-Defined Numeric Formats
    User-Defined String Formats

    ---
    Phil Weber



  6. #36
    Mike Culley Guest

    Re: How to "untrim" variable?


    LOL!

    I was a technician putting PCs together and occasionally helping a VB programmer.
    He told me he hated arrays. He said he tried all day to do something without
    an array and in the end was forced to give in. It soon became apparent that
    as a hobby programmer I knew more than this guy. After a while he left and
    I got my first programming job

    Mike Culley

    Tony Smith <ajsmith@rivernet.com.au> wrote:
    >Well, it's a chicken & egg situation. It's nice if it works well the
    >first time. I always thought optimisation was fixing it after someone
    >complains it's slow!
    >
    >Actually, I sometimes cringe when I write something, and 'dumb it
    >down'. In the long run, I know it's going to haunt me if I do
    >something 'clever'. I have written stuff when six months later -
    >'what the ****?'.
    >
    >A firm I worked for once hired a VB programmer. A few weeks later he
    >asked - 'How do I get a value out of a subroutine?'. No joke. I
    >didn't know what to say. He solved his own problem 'Oh, don't worry,
    >I just make everything global'. I left soon after... but everything I
    >showed him was generally the 'easy' way, so his code at least worked.
    >
    >Want to talk about standards next, or will we leave that for another
    >thread?
    >
    >Tony
    >
    >
    >Phil Weber wrote:
    >>
    >> > Ah, but the program worked properly. That's
    >> > the point. Get [it] to work, optimise it later.

    >>
    >> Tony: If you've ever had time to go back and "optimise it later," you

    live
    >> in a different world than I do. Doesn't it make more sense to code it

    right
    >> the first time, especially if you can do so with little or no additional
    >> effort?
    >> ---
    >> Phil Weber



  7. #37
    Alan Gillott Guest

    Re: How to "untrim" variable?

    I still keep my VB 3 Manuals. They are still streets ahead of anything that
    has been published since.

    Audie F. Thomas <audietech@erols.com> wrote in message
    news:390e181d@news.devx.com...
    > Since I brought it up, does anyone know of good complete documentation on
    > the syntax used in the Format function? The VB6 help on this is very
    > incomplete.
    >
    > --
    > Regards,
    > Audie F. Thomas
    > Audie Technology, Inc.
    > sales@audietech.com
    >
    >




  8. #38
    Brent Guest

    Re: How to "untrim" variable?


    As Alan says the VB3 docs are good, as are the VB4 docs (programmers reference,
    etc.). I think MS still sells the VB Programmer's Reference and the other
    books once included with the product... if they are available you should
    be able to order them online or find them at your local bookstore.



    "Alan Gillott" <agillott@tact.com> wrote:
    >I still keep my VB 3 Manuals. They are still streets ahead of anything that
    >has been published since.
    >
    >Audie F. Thomas <audietech@erols.com> wrote in message
    >news:390e181d@news.devx.com...
    >> Since I brought it up, does anyone know of good complete documentation

    on
    >> the syntax used in the Format function? The VB6 help on this is very
    >> incomplete.
    >>
    >> --
    >> Regards,
    >> Audie F. Thomas
    >> Audie Technology, Inc.
    >> sales@audietech.com
    >>
    >>

    >
    >



  9. #39
    Karl E. Peterson Guest

    Re: How to "untrim" variable?

    Hi Tony --

    > It comes down to 'what's it worth?'. Time is money. Odds are, this
    > line of code gets executed once only, so a sub-millisecond time saving
    > is worth zero.


    Hmmmm, seems to me one of the most common uses for such an exercise would be in a
    file i/o problem. Say you were writing millions of lines to thousands of files.
    Could start to add up pretty fast. <g>

    > I rarely time my code these days. If it 'seems' slow I'll take a
    > look, but if it works, I'm leaving it as is.


    I hear ya. But, OTOH, you probably know from experience what techniques are
    faster -- in general. And, in fact, you even say as much in your post. Phil's
    right, that newbies deserve to have slower options red-flagged, so they'll one day
    too know by instinct which way to turn.

    Later... Karl




  10. #40
    Karl E. Peterson Guest

    Re: How to "untrim" variable?

    Hi Rick --

    > Anyway, if I offended you (or others reading this thread), I do apologize.
    > It was never my intention to become abrasive.


    Don't sweat it. Entertaining (and educational) reading. I'm sure lots of folks
    found good food for thought in the exchange. (Even if you did lose. ;-)

    Later... Karl




  11. #41
    Shelly Rosenfeld Guest

    Re: How to "untrim" variable?


    Even MVPs make syntax errors - y'all missing a right parentheses...

    > (Even if you did lose. ;-)


    Sheldon



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center