Menu

little improvement?

limeng
2011-10-21
2013-04-15
  • limeng

    limeng - 2011-10-21

    Hi Bhavbhuti:
    maybe a little bug in CB I found,of course for beginner may make such mistakes.


    *} Library: cBhavior.VCX
    *} Class: cDataBehavior
    *} Method: SetNewPK()


    in function above ,the code follows

    lcPrimaryKey = CURSORGETPROP("KEYFIELDLIST")

    *** EGL: 07/06/1999 - Check to see IF the PK field already has a value.
    IF NOT EMPTY(EVAL(ALIAS() + "." + lcPrimaryKey))
    * There already is a value; no need to assign another.
    RETURN
    ENDIF
    =====================================

    if PK is not properly set or not set at all(my mistakes :) ), then "lcPrimaryKey " is empty just like "", in this case:

    the code <<IF NOT EMPTY(EVAL(ALIAS() + "." + lcPrimaryKey))>> is syntax error,and an error MISSAGEBOX will occur TO hint you.

    not so friendly message for me ,because the CB code shoule be OK, especially for syntax. so can better message box to hint user?

    little improvement is like this

    IF  EMPTY( lcPrimaryKey))
          messagebox("PK is not set in this table,please set PK for CB using")
         return
    ENDIF

    *** EGL: 07/06/1999 - Check to see IF the PK field already has a value.
    IF NOT EMPTY(EVAL(ALIAS() + "." + lcPrimaryKey))
    * There already is a value; no need to assign another.
    RETURN
    ENDIF


    just suggestion for CB!
    thank you
    Limeng

     
  • Bhavbhuti Nathwani

    Hey!  A very good suggestion Limeng.  What I would suggest is that you update the CodeBook source with this bugfix, that should benefit all the users.  This is all what Open Source is all about.  Cheers!

     
  • limeng

    limeng - 2011-10-23

    hi venussoftop:
    Glad to read your suggestion for me !
    but can anyone modify the CB code? It seems can only download the code by CVS anonymousely.

    I guess only developer in your CB team own such right.

    Limeng

     
  • limeng

    limeng - 2011-10-24

    hi venussoftop !

    I have added the test code for this "bug"!
    But I think I have no privilege to modify CB code,  SO CAN YOU ADD IT TO CB INSTEAD OF MYSELF?

    the code exists in the followed function:
    *----------- Location Section --------------
    *} Library: cBhavior.VCX
    *} Class: cDataBehavior
    *} Method: SetNewPK()


    the new part is:
    IF CURSORGETPROP("SOURCETYPE") # DB_SRCTABLE
    * Note: This code assumes that you have a single updatable table per view.
    * You will have to code your own behavior IF you wish to pre-fetch the
    * primary keys for a multiply-updatable view.
    * It also works with single-field PKs, not the concatenated field list-type.
    lcBaseTable = CURSORGETPROP("TABLES")
    lcPrimaryKey = CURSORGETPROP("KEYFIELDLIST")

    *** The following code was suggested by Limeng. to avoid empty lcPrimaryKey value fetched for no PK set at all
    *   or uncorrectly set PK of the TABLE.
    IF  EMPTY(lcPrimaryKey)
    MESSAGEBOX("PrimaryKey is NULL in VIEW " + ALIAS() + "!, please CHECK whether PK is properly set in the according table!")
    RETURN
    ENDIF

    *** EGL: 07/06/1999 - Check to see IF the PK field already has a value.
    IF NOT EMPTY(EVAL(ALIAS() + "." + lcPrimaryKey))
    * There already is a value; no need to assign another.
    RETURN
    ENDIF

    ….other original code…

    ==================================
    I am not sure whether this is the best way to test this bug, since there is such a complex error handle system in CB which I have not master.

    Limeng

     
  • Bhavbhuti Nathwani

    Sorry was away from the desk so could not reply earlier.  I think only  Ed can add developers, but can you use TortoiseCVS and upload your changes as an Anon developer?  Also don't hesitate to put your name and date in the code comment as Ed has done in the following lines.  Tell me how it goes for you

     
  • limeng

    limeng - 2011-12-30

    I have try to download code from CVS, but seems password is not EMPTY?
    I just followed instructions "cvs -d:pserver:anonymous@codebook.cvs.sourceforge.net:/cvsroot/codebook login
    cvs -z3 -d:pserver:anonymous@codebook.cvs.sourceforge.net:/cvsroot/codebook co -P modulename
    "
    both two instructions cannot download source code with EMPTY password which is said should be ok :“The module you wish to check out must be specified as the modulename. When prompted for a password for anonymous, simply press the Enter key”?

    so what happened? I use tortoiseCVS to access the code?not this reason I think.
    Limeng

     
  • limeng

    limeng - 2011-12-30

    this is the infor CVS displayed:
    In E:\persion\dev\frame\cb62\codebooksource: "C:\Program Files\TortoiseCVS\cvs.exe" "-q" "checkout" "-P" "modulename"
    CVSROOT=:pserver:anonymous@codebook.cvs.sourceforge.net:/cvsroot/codebook co -P modulename

    cvs.exe checkout: Empty password used - try 'cvs login' with a real password

    cvs.exe : authorization failed: server codebook.cvs.sourceforge.net rejected access to /cvsroot/codebook co -P modulename for user anonymous

    Error, CVS operation failed

    In : "C:\Program Files\TortoiseCVS\cvs.exe" "-q" "login"
    CVSROOT=:pserver:anonymous@codebook.cvs.sourceforge.net:/cvsroot/codebook co -P modulename

    Logging in to :pserver:anonymous@codebook.cvs.sourceforge.net:2401:/cvsroot/codebook co -P modulename

    Error, CVS operation failed

     
  • Bhavbhuti Nathwani

    Hi Limeng

    I have not CVSed for quite some time now.  Have you installed PuTTY?  Have you gone through the formalities for PuTTY?  Check out the SourceForge documents for:
    1) Document F02 - SourceForge.net: SSH Key Generation and Usage
    2) Fingerprint Listing
    and
    3) Document F04 - SourceForge.net: CVS Client: TortoiseCVS with PuTTY

    Hope this helps.

    Wishing everyone Seasons Greetings and a Happy New Year!

    Kind regards
    Bhavbhuti

     
  • limeng

    limeng - 2011-12-30

    hi Bhavbhuti:
    Thank you ! I have try several times ,and EMPTY password is ok!
    but the following is shown :
    "Module list not available for server codebook.cvs.sourceforge.net.
    Ask your administrator to either install a web browser interface on the server(CVSweb or ViewCVS) or add the modules to the CVSROOT/modules files.
    Meanwhile, you'll have to find the module name elsewhere."

    and I also find ViewVC is installed but not ViewCVS, when I click "Fetch list" from TCVS interface, the information above will be shown, so modules not find.

    I will try again to find what is wrong,and if cannot download finally,I will try your suggestion!

    XIN NIAN HAO !(Happy new year in chinese) :)

    Kind regards
    Limeng

     
  • limeng

    limeng - 2012-01-04

    hi Bhavbhuti:

    I have successfully got the code from repository of codebook, the reason I failed is  I didnot enter the modulename in TCVS and want to get all the modules by “Fetch list”,so nothing fetehed.

    so I guess ED didnot set the CVSROOT/modules files,SO YOU MUST enter the modename explicitly just as what is said in web
    <The module you wish to check out must be specified as the modulename. When prompted for a password for anonymous, simply press the Enter key>

    BUT, what confused me is I just copy the instruction without any modification so modulname is really "modulename".
    :) ,so stupid mistakes!!

    I enter "codebook" in moduel and all the code canbe download!!

    so I suggest the original instruction set <cvs -z3 -d:pserver:anonymous@codebook.cvs.sourceforge.net:/cvsroot/codebook co -P modulename > should be rewrite like this is better to understand.
    <cvs -z3 -d:pserver:anonymous@codebook.cvs.sourceforge.net:/cvsroot/codebook co -P codebook>.

    BTW, I find the file <CvsEditTest.txt> which seems other guys who want view or modify the code by CVS to test.
    content like this :
    2002.4.3 - File created and uploaded by Ed Leafe.
    Hi Ed, just testing my CVS update ability with this Project
    Um..just checking CVS (seem to have lost it with anoth project)
    2004.6.7 Testing the CVS edit. Mike Pratt
    2009.2.3 Testing Bhavbhuti Nathwani.

    and I just added "2012.1.3 Testing Limeng" at the end, but I have no priviledge to commit,for anonymous can only check out code and no commit right.

    so can I commit the modification(in 2011-11-03 23:28:27 PDT suggest) ?I think I cannot.

    Kind regards
    Limeng

     
  • Bhavbhuti Nathwani

    Hi Limeng, please contact Ed Leafe in this matter.

    HTH

    Bhavbhuti

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.