I dont know if it matters (I think it actually does) but this test program
is using a GetAs() with a format that contains a space. AFAIK (and that
ain't much) the format parser is not all that tolerant of spaces.

--JYL

> Well, you got me on this one also.  I've been using int props in other
> places without trouble, but this test program doesn't work.  I'm looking
> into it further.  FWIW, I'm running Metakit 2.4.7 on Windows.
>
> 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 12:29 PM
>> 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