Yup -- that too.  I checked my code that uses MetaKit and there are no
spaces in the property names.  I didn't realize that I did that when I
put together the test code.

jeffrey kay 
weblog <k2.com> pgp key <www.k2.com/keys.htm> aim <jkayk2>
share files with me -- get shinkuro -- <www.shinkuro.com>

"first get your facts, then you can distort them at your leisure" --
mark twain 
"if the person in the next lane at the stoplight rolls up the window and
locks the door, support their view of life by snarling at them" -- a
biker's guide to life
"if A equals success, then the formula is A equals X plus Y plus Z. X is
work. Y is play. Z is keep your mouth shut." -- albert einstein


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jim Hu
> Sent: Thursday, May 29, 2003 3:37 PM
> To: Jeffrey Kay; [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: [Metakit] Help on Int property
> 
> 
> Jeffrey & Jacob,
> 
>      Thank you so much for help. The real problem to cuase wrong data
> saved into database I have just find out is because I left a space in
> front the word value in the line
> 
> c4_View kdeck = storage.GetAs("kdeck[name:S, value:I]");
> 
> What you found is also right. I wonder if the space problem
> is a Metakit bug or something I do not know. Please advise.
> 
> Many thanks.
> 
> Jim
> 
> -----Original Message-----
> From: Jeffrey Kay [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 29, 2003 1:38 PM
> To: Jim Hu; [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: [Metakit] Help on Int property
> 
> 
> Okay, here's a program that works and why (AFAIK).  
> c4_IntProp does not
> have an automatic cast to an int.  The operator() returns a c4_IntRef,
> which doesn't seem happy about automatically being cast to an int.  If
> you assign the value directly to an int, or presumably force the cast,
> then it should work fine.  
> 
> I'm surprised that I never noticed this, but perhaps it's because I
> don't usually printf anything.
> 
> #include "mk4.h" 
> #include "mk4str.h" 
> #include <stdio.h> 
> 
> main() 
> { 
>       c4_StringProp pName("name"); 
>       c4_IntProp pValue("value"); 
> 
>       c4_Storage storage("kdeck.db",true); 
> 
>       c4_View kdeck = storage.GetAs("kdeck[name:S,value:I]"); 
>       
>       kdeck.Add(pName["proc_cdp_first"] + pValue[1]);
>       kdeck.Add(pName["proc_cdp_last"] + pValue[676]);
>       
>       storage.Commit();
>       
>       for(int j=0;j<kdeck.GetSize();j++) {
>               int x = pValue(kdeck[j]);
>               printf("V%d = %d\n",j,x);
>       }
>       
>       kdeck.Add(pName["proc_cdp_inc"] + pValue[1]);
>       storage.Commit(); 
> 
>       return(0); 
> } 
> 
> 
> 
> jeffrey kay 
> weblog <k2.com> pgp key <www.k2.com/keys.htm> aim <jkayk2>
> share files with me -- get shinkuro -- <www.shinkuro.com>
> 
> "first get your facts, then you can distort them at your leisure" --
> mark twain 
> "if the person in the next lane at the stoplight rolls up the 
> window and
> locks the door, support their view of life by snarling at them" -- a
> biker's guide to life
> "if A equals success, then the formula is A equals X plus Y 
> plus Z. X is
> work. Y is play. Z is keep your mouth shut." -- albert einstein
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of Jim Hu
> > Sent: Thursday, May 29, 2003 1:00 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [Metakit] Help on Int property
> > 
> > 
> > Jacob,
> > 
> >      I have just built and installed metakit 2.4.9.2 on 
> > ReadHat Linux 7.1.2
> > gcc 2.96. I have got exactly the same wrong reslut as on 
> > Solaris 5.6 with gcc 2.95.3
> > and ReadHat 6.1 with gcc 2.91.66.
> > 
> > Best regards
> > 
> > JH
> > 
> > -----Original Message-----
> > From: Jim Hu 
> > Sent: Thursday, May 29, 2003 11:29 AM
> > To: '[EMAIL PROTECTED]'
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [Metakit] Help on Int property
> > 
> > 
> > Jacob,
> > 
> >     Many thanks for your reply. I did build the test and they 
> > are all right to me. I only change Jeff's
> > code line 20 from 
> > 
> > kdeck.Add(pValue["proc_cdp_inc"] + pValue[1]);
> > 
> > to 
> > 
> > kdeck.Add(pName["proc_cdp_inc"] + pValue[1]);
> > 
> >   I have just posted another message regarding mixture of 
> > string and integer.
> > I will try an newer version of ReadHat and gcc to see if the 
> > problem still happens.
> > 
> > Best regards
> > 
> > Jim
> > 
> > -----Original Message-----
> > From: Jacob Levy [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, May 29, 2003 11:08 AM
> > To: Jim Hu
> > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: RE: [Metakit] Help on Int property
> > 
> > 
> > Jim
> > 
> > The versions of Solaris and GCC you're using are quite old. 
> > I'm not sure
> > whether Metakit has been tested with these. I suggest you do 
> > a 'make test'
> > in Metakit first, to ensure that you're getting a good 
> build. I don't
> > really expect any problems, but it's just one more thing that 
> > you should
> > check to eliminate any possible question marks later on.
> > 
> > I see you're using Metakit 2.4.9.2, that's great, that's the 
> > right version
> > to use. In all, I've found this version to be the best yet, 
> > rock solid and
> > very easy to build/install.
> > 
> > Also, please repost the code you are running with Jeff's 
> > modifications, so
> > we can see if there's any bugs introduced by your adoption of Jeff's
> > suggestions.
> > 
> > Thanks! --JYL
> > 
> > > Dear Jeffrey,
> > >
> > >      Further to my last email, I quickly install metakit on 
> > Solaris 5.6
> > > with gcc 2.95.3.
> > > I tested demo and dump, they gave correct results. But when 
> > I run your
> > > code, I got
> > >
> > > V0 = -268436744
> > > V1 = -268436744
> > >
> > > and dump the result gave me the same as on Linux
> > >
> > > kdeck.dat: 1 properties
> > >   kdeck[name:S, value:I]
> > >
> > >  VIEW     1 rows = kdeck:V
> > >     0: subview 'kdeck'
> > >    VIEW     3 rows = name:S  value:I
> > >       0: 'proc_cdp_first' 0
> > >       1: 'proc_cdp_last' 0
> > >       2: 'proc_cdp_inc' 0
> > >
> > >   I cannot figure out what I have done wrong
> > >
> > > Best regards
> > >
> > > Jim
> > >
> > > -----Original Message-----
> > > From: Jim Hu
> > > Sent: Thursday, May 29, 2003 9:19 AM
> > > To: 'Jeffrey Kay'
> > > Subject: RE: [Metakit] Help on Int property
> > >
> > >
> > > Dear Jeffrey,
> > >
> > >       Thank you so much for your reply. I wonder if my 
> > there is anything
> > > wrong with
> > > my installation as your code gives the wrong result as well 
> > (there is a
> > > bug in the line 20). The running results are
> > >
> > > V0 = 134525096
> > > V1 = 134525096
> > >
> > > and the dump resluts are
> > >
> > > kdeck.dat: 1 properties
> > >   kdeck[name:S, value:I]
> > >
> > >  VIEW     1 rows = kdeck:V
> > >     0: subview 'kdeck'
> > >    VIEW     3 rows = name:S  value:I
> > >       0: 'proc_cdp_first' 0
> > >       1: 'proc_cdp_last' 0
> > >       2: 'proc_cdp_inc' 0
> > >
> > > would you help me run the code on your system. I am use 
> RedHat 6.1.
> > >
> > > Best regards
> > >
> > > Jim
> > >
> > > -----Original Message-----
> > > From: Jeffrey Kay [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, May 29, 2003 9:03 AM
> > > To: Jim Hu
> > > Cc: [EMAIL PROTECTED]
> > > Subject: RE: [Metakit] Help on Int property
> > >
> > >
> > > See if this simplifies what you are trying to do ...
> > >
> > > #include "mk4.h"
> > > #include "mk4str.h"
> > > #include <stdio.h>
> > > main()
> > > {
> > >        c4_StringProp pName ("name");
> > >        c4_IntProp pValue ("value");
> > >        c4_Storage storage("kdeck.dat", true);
> > >        c4_View kdeck = storage.GetAs("kdeck[name:S, value:I]");
> > >
> > >    kdeck.Add(pName["proc_cdp_first"] + pValue[1]);
> > >    kdeck.Add(pName["proc_cdp_last"] + pValue[676]);
> > >
> > >    storage.Commit();
> > >
> > >    for(int j=0;j<kdeck.GetSize();j++) {
> > >           printf("V%d = %d\n",j,pValue(kdeck[j]));
> > >    }
> > >
> > >    kdeck.Add(pValue["proc_cdp_inc"] + pValue[1]);
> > >        storage.Commit();
> > >        return(0);
> > > }
> > >
> > > I'm not sure exactly where your logic was heading, but this is the
> > > simplest way to add and retrieve values from rows in a view.  To
> > > dereference a particular row in a view, the syntax is 
> > c4_View[rownum].
> > > To dereference a particular value in a particular row, it's
> > > c4_Prop(c4_View[rownum]).  You can assign a particular 
> row to a row
> > > variable also, but for most things I usually use the 
> approach shown
> > > above.  Similarly, if I'm tracking down a particular row, I 
> > use Find or
> > > Select and then use the row number to make the property 
> > changes as shown
> > > in this example.  There are a couple of things that you 
> > need to be aware
> > > of if you use derived views, but we'll cross that bridge 
> > when you get to
> > > it.
> > >
> > > jeffrey kay
> > > weblog <k2.com> pgp key <www.k2.com/keys.htm> aim <jkayk2>
> > > share files with me -- get shinkuro -- <www.shinkuro.com>
> > >
> > > "first get your facts, then you can distort them at your 
> leisure" --
> > > mark twain
> > > "if the person in the next lane at the stoplight rolls up 
> > the window and
> > > locks the door, support their view of life by snarling at 
> them" -- a
> > > biker's guide to life
> > > "if A equals success, then the formula is A equals X plus Y 
> > plus Z. X is
> > > work. Y is play. Z is keep your mouth shut." -- albert einstein
> > >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf
> > > Of Jim Hu
> > > 
> > Sent: Thursday, May 29, 2003 9:50 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [Metakit] Help on Int property
> > >
> > >
> > > Hi, all,
> > >      I am just starting to use Metakit (2.9.4.2). I used 
> > the demo.cpp as
> > > an example and wrote
> > > the following piece of code. When I use the dump to dump 
> > the result, the
> > > integer part of values
> > > are all zeros. Where did I do wrong? Please advise.
> > >
> > > #include "mk4.h"
> > > #include "mk4str.h"
> > > #include <stdio.h>
> > > main()
> > > {
> > >        c4_StringProp pName ("name");
> > >        c4_IntProp pValue ("value");
> > >        c4_Storage storage("kdeck.dat", true);
> > >        c4_View kdeck = storage.GetAs("kdeck[name:S, value:I]");
> > >        c4_Row row;
> > >        pName (row) = "proc_cdp_first";
> > >        pValue(row) = 1;
> > >        kdeck.Add(row);
> > >        pName (row) = "proc_cdp_last";
> > >        pValue(row) = 676;
> > >        storage.Commit();
> > >        int v1 = pValue(row);
> > >        printf("V1 = %d\n", v1);
> > >        kdeck.Add(row);
> > >        int v2 (pValue (kdeck[1]));
> > >        printf("V2 = %d\n", v2);
> > >        pName (row) = "proc_cdp_inc";
> > >        pValue(row) = 1;
> > >        kdeck.Add(row);
> > >        storage.Commit();
> > >        return(0);
> > > }
> > > Sincerely,
> > > Jim Hu
> > >
> > > _______________________________________________
> > > metakit mailing list  -  [EMAIL PROTECTED]
> > > http://www.equi4.com/mailman/listinfo/metakit
> > 
> > 
> > 
> > _______________________________________________
> > metakit mailing list  -  [EMAIL PROTECTED]
> > http://www.equi4.com/mailman/listinfo/metakit
> > 
> 
> _______________________________________________
> metakit mailing list  -  [EMAIL PROTECTED]
> http://www.equi4.com/mailman/listinfo/metakit
> 

_______________________________________________
metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to