[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q's for Jason or Daniel
The default value for the flag field IS 0|0 (no flags)... but when you
fill it out via web forms instead of code, for some reason it doesn't get
set... I dunno if the web submits a space or what... but it's not
submitting NULL or else the 0|0 would be set.
The answer for you is 0|1 IF no other flags were set. That's what I was
saying... your going to have to read in the flag string, check what flags
are currently set, maintain those (don't alter) and just flip the first
one. Does that make sense?
On Fri, Jan 14, 2000 at 03:40:21PM -0800, Aaron Turner wrote:
>
> Heh, damn that's complicated. :) Just couldn't make it simple could you?
> Geez... Ok, enough bitching :)
>
> So the answer is:
>
> 0|1
>
> yes?
>
> Second thing, shouldn't the DB schema set a reasonable default for all
> non-requrired fields like this? Yes I'm lazy.
>
> Thanks.
>
> On Fri, 14 Jan 2000, Jason Pincin wrote:
>
> > On Thu, Jan 13, 2000 at 09:51:39PM -0800, Aaron Turner wrote:
> > > 1) How do I indicate/test for a local vs. remote external link? It looks
> > > like the info is stored in the "flags" field in "KBObjects" table. But
> > > what is the flag? A "1"? ObjectProperties doesn't make any sense to me.
> >
> > OK... here's how Flags actually work, in PHP code. That 0|0 you see is
> > actually INT|INT (integer pipe integer). Now, when PHP examines the
> > flags, it splits those integeres into two seperate vars... I just do a
> > split on pipe. It then converts the decimals to BINARY strings. If the
> > string is less than 31 chars long, it fills the beginning in with 0's to
> > make it so. It THEN looks at the position in THAT binary string that
> > coresponds with what you see in ObjectProperties. So... Because you have
> > the local flag as position "1", that test occurs by testing the FIRST (1)
> > character in the bit string, starting from the right. If it's a one, the
> > flag is set, if it's 0 - it's not set.
> >
> > BUT NEVER STORE IT IN BINARY FORM. :) It's always stored in decimal
> > form. Also - the first decimal-converted-into-binary string represents
> > global flags. Flags shared across all objects. This local flag is NOT
> > one of those. So you're interested in the second (after the pipe) decimal
> > value which you'll convert to a binary string.
> >
> > Does this clear it up at all?
> >
> > >
> > > 2) Does move_object() update the KBObject record or does it recreate it?
> > > More specifically, can I depend on ObjectID not changing overtime for a
> > > record? If I can't depend on it, how does one recommend I do record
> > > matching for articles between the DB and an external file? If the
> > > ObjectID changes, it will require manual intervention to fix.
> >
> > It updates the KBObject Record. The ObjectID remains the same.
> > ObjectLocation changes. All child objects of that object are updated as
> > well. All of they're ObjectID's stay constant - but ALL of their
> > ObjectLocations are updated.
> >
> > >
> > > 3) Does anyone know of a way to run PHP code outside of Apache like a
> > > regular program? If so, is there a way we can get some functions like
> > > move_object(), and the insertion routines in such a program?
> >
> > I heard rumors of a cmd line php script engine... which would take PHP
> > code and execute it just like a perl script, with all the same interfaces
> > as Apache PHP and everything... I had forgotten all about it - but now
> > that you mention it... it MAY be for PHP4 though... I'm not sure. I'll
> > look into it. Dan - can you look into it too and see if you come up with
> > anything?
> >
> > > 4) Failing that, can someone write a simple PHP script that
> > > allows me to use things like create_object(), fetch_object(),
> > > move_object(), via a CGI URL interface- ie not a form?. Kinda like:
> > > command.php?action=create_object&location=1.2.10&name=aturner&type=8 etc...
> >
> > Good idea. Give us the list of functions you want to access.
> >
> > > The idea is that I can utilize the PHP Object code via Perl by talking to
> > > Apache. The PHP should return intelligent error codes. I've decided that
> > > writing my own set of objects for Perl is too much right now to go live by
> > > Feb 1st and this should do nicely.
> >
> > I think ever duplicating the objects in Perl would be sort of a waste of
> > time. I like your above idea much if we can't find a CLI PHP script
> > engine.
> >
> > > Basically for #3 and #4 I'd need everything one would need to manage the
> > > KBObjects/ExternalLinks tables for documents (internal pages and things
> > > mirrored locally/remotely). I might give it a go myself, but I need to
> > > learn the PHP objects which I'm a bit rusty at and someone else would
> > > probably do it about 10x faster.
> >
> > I'll give it some thought today... maybe play around... see if I can get
> > something for you to test... not promising anything BY today... as my new
> > CPU is arriving at noon... BUT... I'll try :).
> >
> >
> > --
> > Jason
> > http://vodka.linuxkb.org/~chardros
> >
>
> --
> Aaron Turner, Core Developer http://vodka.linuxkb.org/~aturner/
> Linux Knowledge Base Organization http://linuxkb.org/
> Because world domination requires quality open documentation.
> aka: aturner@vicinity.com, aturner@pobox.com, ion_beam_head@ashtech.net
> The difference between `Unstable' and `Usable' is only two characters: NT
--
Jason
http://vodka.linuxkb.org/~chardros