Page 1 of 6 1234 ... LastLast
Results 1 to 40 of 206

Thread: Giving away code.....a drawback

  1. #1

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251

    Unhappy Giving away code.....a drawback

    Just an observation that I have seen over and over again.

    Many advanced people on this forum will readily post complex code for people that can't even figure out the InStr function.

    In some cases I think that is fine, but I also know, from experience, that if you are given the code to solve a difficult problem, and it works, you will probably not take the time to figure out why it works, or how it works, thereby not learning anything.

    The code below is an example from my past, I had no clue what it did then, and I still don't, because it worked from day one and has never had a bug (except for commenting out the first If).

    This code is very poorly written, so perhaps it's a bad example, but it is a good example of the point I am making.

    Code:
    Private Function RSEncode(NumRSSyms As Integer, TmpArray() As String, ParitySyms() As String) As Integer
    
    '------------------------------------------------------------------
    ' This function accepts as inputs the number of input symbols, an
    ' array where the input symbols are stored and an output array
    ' where the resulting output symbols are stored.
    '------------------------------------------------------------------
        'Code supplied by AustraliaPost web site
        'SSS 02/99 AU Mail update
    
        Dim N As Integer
        Dim i As Integer
        Dim j As Integer
        ReDim mult(0 To 63, 0 To 63) As Integer    'used for Reed Solomon error correction
        ReDim gen(0 To 4) As Integer              '  "   "    "     "      "        "
        ReDim temp(31) As Integer
        'Static RSInited As Integer
        ReDim ParitySyms(0 To 3) As String
        
        'If Not RSInited Then
            'RSInit needs to be called once at the start
            'Code supplied by AustraliaPost web site
            'I don't claim to understand it-SSS
            
            Dim primpoly As Integer
            Dim testv As Integer
            Dim prevv As Integer
            Dim nextv As Integer
            'Dim i As Integer
            'Dim j As Integer
            
            primpoly = 67       ' a**6 + a + 1 where a (alpha) is 2
            testv = 64
            
            For i = 0 To 63
                mult(0, i) = 0
                mult(1, i) = i
            Next i
        
            prevv = 1
            For i = 1 To 63
                nextv = prevv * 2
                If (nextv >= testv) Then
                    nextv = nextv Xor primpoly
                End If
                
                For j = 0 To 63
                    mult(nextv, j) = mult(prevv, j) * 2
                    If mult(nextv, j) >= testv Then
                        mult(nextv, j) = mult(nextv, j) Xor primpoly
                    End If
                Next j
                
                prevv = nextv
                
            Next i
            
            gen(0) = 48
            gen(1) = 17
            gen(2) = 29
            gen(3) = 30
            gen(4) = 1
                
            'RSInited = True
        'End If
    
        On Error GoTo OOOps
        
        N = NumRSSyms + 4
    
        For i = 0 To 3
            temp(i) = 0
        Next i
        
        For i = 4 To N - 1
            temp(i) = Val(TmpArray(N - 1 - i)) 'Fill in reversed order
        Next i
        
        For i = NumRSSyms - 1 To 0 Step -1
            For j = 0 To 4
                temp(i + j) = temp(i + j) Xor mult(gen(j), temp(i + 4))
            Next j
        Next i
        
        For i = 0 To 3      ' Fill in the resulting output array
            ParitySyms(i) = Str(temp(i))
        Next i
        
        RSEncode = 0
        On Error GoTo 0
    
        Exit Function
        
    OOOps:
        RSEncode = 1
        Exit Function
    
    End Function

  2. #2
    Registered User Olly's Avatar
    Join Date
    Apr 2001
    Location
    Switzerland
    Posts
    252
    Hmm, those who are really interested in vb will learn it anyway.
    Those who aren't won't get too far. But hey, it's great too to examine difficult code and experiment with it. Learning by manipulating.


  3. #3
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    I'm usually a nice person and would refrain from saying things like this but.........................

    You, Sir, have an attitude problem.

    My cubemate has answered many questions on this site and invariably you follow immediately afterward with practically the same code with a few variations and some nasty comment about how his code is sloppy code or how his code was much more complex than it needed to be and how does he expect people to learn with such examples or some such nonsense! According to your not very well informed opinion, it's a miracle he has a job if he is such a poor programmer!

    I have worked with this man for three years and he is an excellent programmer and is very well paid for what he does. He is also a fine human being who takes his time to teach other people so..........stuff that in your ear!

  4. #4

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    I don't agree, people will learn what they NEED to learn. Especially, if they do it for a living.

    Nice sign!

  5. #5
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by barrk
    I'm usually a nice person and would refrain from saying things like this but.........................

    You, Sir, have an attitude problem.

    My cubemate has answered many questions on this site and invariably you follow immediately afterward with practically the same code with a few variations and some nasty comment about how his code is sloppy code or how his code was much more complex than it needed to be and how does he expect people to learn with such examples or some such nonsense! According to your not very well informed opinion, it's a miracle he has a job if he is such a poor programmer!

    I have worked with this man for three years and he is an excellent programmer and is very well paid for what he does. He is also a fine human being who takes his time to teach other people so..........stuff that in your ear!
    Woah! Warpath Katie strikes again! Who is the cubemate?

  6. #6

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    barrk,

    I do not have an attitude and I am not attacking anyone. You're reference to your cubemate refers to a very specific thread, and I remember it, overall you are completely incorrect.
    Giving code away is NOT the best way to teach someone. The best way is to point them in the right the direction and force then to figure it out on their own, THAT is where retention comes from. Nothing is truely LEARNED until you no longer have to refer to someone elses code (or past code that someone gave you) in order to duplicate it.
    I am sure your cubemate is very adept, could you survive without him?
    I AM your cubemate in my job, and my cubemate relies on me for answers. I make him work for it, and he is a better programmer because of it.

  7. #7
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    You don't have an attitude problem but "overall I'm completely incorrect"?????????

    Yes, I could survive without my cubemate...he's a very talented young pup but a young pup none the less....and he still teaches me things and vice versa!

    I bet you're just a joy to work with if you have that attitude toward your cubemate........the word mate is in there for a reason you know!

    I do find it quite interesting that you assume that I am the junior member....could you also be the least bit sexist????

  8. #8
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    @"£&^*#!!! You didn't answer!!
    Who is the cubemate?
    could you also be the least bit sexy
    Yeah baby yeah, you know it!!!!

  9. #9

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    #1) I meant you were incorrect about me being critical of other peoples code.

    #2) I didn't know you were female until that comment, I was typing mine when the last one was posted.

    #3) The assumption was my mistake, sorry.

  10. #10
    Registered User Olly's Avatar
    Join Date
    Apr 2001
    Location
    Switzerland
    Posts
    252

    Talking -->to the topic

    When you program hard stuff on your own you will get this "Yeeessss" feeling. If it's just copied n' pasted you won't.
    Those who like feeling like a doughnut with a hole inside will prefer the 2nd one. Also this is not some school teaching forum.
    It would take too long to advise somebody completely from scretch every time by new. People will get that code anyway if not here then somewhere else. If they don't take it serious, then it will just blow away in the wind...Noone will get far with code that he doesn't understand. And at the point of realising that serious folks will start examining the code.


    -->btw, nice to know not to be in a guys only zone here

  11. #11

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    Olly,
    I can accept that. In the process of replying you emphasized a previous point. If people on this forum are not enthusiastic about what they do, then why supply them with code that someone else has worked hard to develop? Make them expend at least a little effort, many people will come here before they even open a help file. I think that is pure laziness and they don't deserve an answer, in some cases.
    I have been forced to learn most of what I know on my own, I know the resources are there.
    Dig a little before you ask for help, and you'll be better off because of it.
    For those people that don't have help/MSDN.....you're not that serious if you don't want to make the investment for a legal copy.

    barrk,
    Learn to have a discussion without getting defensive. As for whether or not I am a "joy to work with", coworkers do like me, but more importantly, they respect me. I am never derogitory, but I do make it obvious when someone asks me something that they could easily find on their own with a little effort.

  12. #12
    Jethro
    Guest
    Who is the ciubemate Katie.....another seppo we can indoctrinate into the aussie culture thing.

    Olly

    Er, your a wild looking dude.

    stevess

    You got a code snippet from Oz Post. You sick puppy, it was probably to do with the pay tv rollout.

    Ok have been given a heap of complex code snippets from time to time here. And have then delved into them line by line to see what they are doing. Generally either ask the poster or some one in our office if can't work out what the hell they are doing.

    Anyone that just pastes in 50 lines of code and doesn't bother analysing it, is not a good programmer and is not going to be a good programmer.

    Have used both approaches when answering questions. Either posted wads of code, (if currently have it on line), or pointed out a function etc which solves the problem. Or even pointed to a web site where they can get the answer.

    So is this a closet thing with you


    This posting brought to you by "Forum Fights - another Parksie/Jethro joint venture".

  13. #13

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    Jethro,
    Can't understand half of what you said, and don't don't know what point you're making with the other half.
    The code I posted I have had had for 2 years and it is in use in the software I support, it is used for generating Australia Post barcodes.
    Who is Oz? Never seen any posts by same.

  14. #14
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by stevess
    For those people that don't have help/MSDN.....you're not that serious if you don't want to make the investment for a legal copy
    MSDN is available at support.microsoft.com and msdn.microsoft.com anyway!
    Who is the ciubemate Katie
    I already asked (see up a few), but she didn't answer, then left.

  15. #15
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by stevess
    Who is Oz? Never seen any posts by same.
    ha ha "Oz" or "Aus" is slang for Australia!! Which planet do you come from?!?

  16. #16
    Jethro
    Guest
    Originally posted by stevess
    Jethro,
    Can't understand half of what you said, and don't don't know what point you're making with the other half.
    The code I posted I have had had for 2 years and it is in use in the software I support, it is used for generating Australia Post barcodes.
    Who is Oz? Never seen any posts by same.
    Are you for really?

    Clearly your powers of analysis leave something to be desired.

    Australia = Oz.

    Chris

    Yeap noticed that, thought l might back you on that one. Currently am thinking it's Dennis...........which would be really weird.

  17. #17
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Yeap noticed that, thought l might back you on that one. Currently am thinking it's Dennis...........which would be really weird
    Nah, Dennis is on the East side of the states, she is in Cali on the west, she keeps pointing that out for some reason.

    I reckon it's someone we've never heard of that has almost no posts or something and has only just started appearing, or they don't both with General VB or Dbase/FF or CC and so don't see them.

  18. #18

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    Is that the typical code that comes out of "Oz"?
    I can only assume that I am out of touch.

    Not to brag, but I work on THE #1 software in the world for non-profit fundraising. GreenPeace, AU is one of our clients (and rather vocal), as well as American Red Cross, Unicef, Salvation Army, and 9900 others.

  19. #19

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    Jethro,

    "Are you for really?"

    Can you speakee English?

    What makes you think that people should know that Oz = Aus?

    I have worked on software that sells in Aus for 3 years and I have never heard the term.

  20. #20
    Jethro
    Guest
    Originally posted by stevess
    Is that the typical code that comes out of "Oz"?
    I can only assume that I am out of touch.

    Not to brag, but I work on THE #1 software in the world for non-profit fundraising. GreenPeace, AU is one of our clients (and rather vocal), as well as American Red Cross, Unicef, Salvation Army, and 9900 others.
    Well that explains things. No Australia Post do not do typical code.Hmmm.....probably why you missed some stuff in previous post, alot of Oz jokes included.

    Chris

    We just have to keep nagging her. Your probably right, though it could be some one we know who doesn't want to admit he knows katie in the flesh. Er, you know what l mean.

  21. #21
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Well it's a term used in Aus and Britain, so maybe you wouldn't have heard of it, but the aussies definately use it.

  22. #22
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by Jethro
    admit he knows katie in the flesh. Er, you know what l mean.

  23. #23

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    I can tell you who she was talking about, give me a minute.

  24. #24

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    You guess who it is.

    I can't seem to get this right.....

    http://161.58.186.97/showthread.php?...ghlight=amazed
    Last edited by stevess; Jun 19th, 2001 at 08:05 PM.

  25. #25
    Jethro
    Guest
    It's telling me the page can't be found.

    Ok have given up on needling ya. Now all l need to find out is that your another seppo with a sense of humour.

  26. #26

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    It works now.

    What's a seppo?

    (More lack of exposure)

  27. #27
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    seppo = American
    pom or pommie = english

  28. #28
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    It's got to be numtel, his location is CA (california) and that's where Katie lives.

  29. #29

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    lol

    What is numtel?

    I am in South Carolina.

    Humbly, a stupid seppo.

  30. #30
    Jethro
    Guest
    Originally posted by stevess
    lol

    What is numtel?

    I am in South Carolina.

    Humbly, a stupid seppo.
    Could also be Eer3 whose location is also CA.

    Sorry Dude,

    Oz slang

    Spectic Tank -> Yank -> Seppo

    Now for the 250,000 question

    What is a Noah?

  31. #31

    Thread Starter
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    I plead the 5th Amendment (The Right to not incriminate one's self, or something like that)

    North American H? ??

    Spectic Tank -> Yank -> Seppo ???????

    Where do the p's and o come from?

    I think we are a little off subject here.




    PS
    Any guesses on who the cubemate is?

  32. #32
    Jethro
    Guest
    Originally posted by stevess
    I plead the 5th Amendment (The Right to not incriminate one's self, or something like that)

    North American H? ??

    Spectic Tank -> Yank -> Seppo ???????

    Where do the p's and o come from?

    I think we are a little off subject here.




    PS
    Any guesses on who the cubemate is?
    Oops spelling mistake...lets try that again

    Septic Tank -> Yank -> Seppo.

    Of course we are off the subject, and we haven't start on the smut yet

  33. #33
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    Grumble Grumble.... typical, I miss all the good fights......

    Personally, I learned to program from reading examples (there weren't any books available for the languages I was using (Hewlett Packard C and Basic back in 1978 odds... both very syntax specific), and it was very instructional. I always try to post code examples as I think it gives a cleaner answer. if the person wants ot learn they will try to find out why the code works the way it does.

    Just my two pennies,

    SD
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  34. #34
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Damn, I miss the good shows, too. Three points for Katie. Sorry, Steve, but have allegainces, besides, I disagree with you, and here is why.

    I learned C++ in university. I learned assembly on the 68K. I've done real programming, I understand the logic and OO and memory management and clock cycles on a very good level. VB is not a very advanced language. It is not a very good language. I'm using VB, VBScript for ASP, and JavaScript. Of these three, I have the most respect for JavaScript, and that is shakey since it is hard to get cross the board compliance to standards.

    Anyway... it is much faster for me now to reverse engineer any code that you may have. I already know how to program. I just need to know the syntax and functions particular to VB/VBScript.

    Now, as to others... well... if they are using VB, I find it hard to believe they are truely in it to learn the subtle side of programming. VB is a very corse, messy way to do things, and it is grossly platform specific.

    Now, give me a moment and I'll rewrite you code. We can all make it nice and pretty, and discuss why we are doing what we are doing. Those who want to learn can learn from that.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  35. #35
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    Originally posted by CiberTHuG
    VB is a very corse, messy way to do things,
    Sounds like my sex life
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  36. #36
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Ah, those were the good old days.

    Anticipated response from SD: What, you enjoyed my sex life?

    Ah... having a sex life, those were the good old days.

    So, SD, do you have a Mullet Hair Daemon?
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  37. #37
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Okay, so I'm mulling through the code. Yes, it could look cleaner, and it could everything declared better, and it could have avoided the use of the label, but... what is it doing? The code is very messy simply because this particular algorithm requires the massive shuffling of array values. I'd hope there is a way to avoid that, but it would require knowledge of Reed Solomon encoding.

    My biggest change would be to not ask for NumRSSyms. If I'm correct, NumRSSyms is just the UBound for TmpArray.

    *shrug*
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  38. #38
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary, Canada
    Posts
    453
    Originally posted by CiberTHuG

    So, SD, do you have a Mullet Hair Daemon?
    Yes! It's rather fetching isn't it!

    SD
    "I'd rather have a full bottle in front of me than a full frontal lobotomy!"

  39. #39
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    I am Southern, I am not a Redneck.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  40. #40
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Aha new friends of Katie's join the...party
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Page 1 of 6 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width