Re: How to show data of relations rather than external symbol?

2014-06-30 Thread Alexander Burger
Hi David,

> > As gui components are typed, you would have to resort to a dumb text
> > field or textarea to show things completely generically.
> 
> I like this idea of a dumb text field just displaying the data.  Can you
> elaborate on this?

As GUI components for DB entities are typically bi-directional (DB stuff
is displayed to the user, and changes are written back to the DB), such
a generic field does not really make much sense.

Instead of an "intelligent" component, you are perhaps better of with
some static HTML display. For example, in a standard app, you could
simply do

   ( NIL
  (show *ID) )

and perhaps use your custom 'show' instead of the build-in one.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to show data of relations rather than external symbol?

2014-06-30 Thread andreas
Hi David

About your first question, did you check out the semicolon-function (;) ?
http://software-lab.de/doc/ref_.html#;

(; Entity theproperty) returns the property.
to show it, you could do (show (; Entity theproperty))

As ABU mentioned (getl) you can fetch all properties of a symbol.
http://software-lab.de/doc/refG.html#getl

some untested code snippet which fetches all properties and applies (show)
on them:
(class +A +Entity)
(dm show> ()
  (for Prop (getl This)
 (show Prop) ) )
or shorter as:
(dm show> ()
   (mapcar show (getl This)) )

With this you can make a customized reimplementation of show, maybe
something like this (untested code, just to give you some ideas):

(dm show> ()
  (let (Indent 0
Obj This)
 (recur (Indent Obj)
   (println (type Obj)) # print list of classes of This
   (for Prop (getl This) # iterate over all properties of This
  (inc 'Indent)
  (align Indent " ")
  (prinl (name Prop)) # print the name of the property
  (inc 'Indent)
  (recurse Indent Prop) ) ) ) )

This is only working in REPL of course (if its working, not tested).
For the html gui you will need another way, like replacing all (prinl)
statements with html generating code (look at lib/xhtml.l)

- beneroth

> Hi David,
>
>> If I have an +Entity with a +Joint to another +Entity and (show ...) it
>> I
>> get an external symbol rather than the data connected to it. How can I
>> show
>> all of the data connected to this object? So far the best I've come up
>> with
>> is to (dm show> ...) and use (show (: theproperty)) but I want to know
>> if
>> there's a more idiomatic way.
>
> If I understand you correctly, you are looking for a generic and
> reflective way to show all data, without having to write entity-specific
> methods, right?
>
> The 'edit' function is remotely doing that, in that it shows the
> class(es) of the object(s) in a relation (and also decodes calendar
> dates). It doesn't show the individual properties of those objects,
> though, but recurses if you click on them with 'K'. In general, I would
> use 'edit' to browse graphs of database objects.
>
> Otherwise, you could write a custom version of 'show' which displays all
> properties of the object using 'getl'. But I do not believe it will be
> visually appealing.
>
>
>> Also how would I connect a (gui ...) component to such an object which
>> will
>> show all of the data of the object rather than external symbols ponting
>> to
>> relations?
>
> As gui components are typed, you would have to resort to a dumb text
> field or textarea to show things completely generically. How about using
> the gui 'repl' function (which opens an interactive REPL in the browser,
> be careful about security issues!!) and then your 'show' from above? ;)
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>



-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to show data of relations rather than external symbol?

2014-06-30 Thread me
Thanks for your speedy reply Alex.

On Jun 30, 2014 2:18 AM, "Alexander Burger"  wrote:
>
> Hi David,
>
> > If I have an +Entity with a +Joint to another +Entity and (show ...) it
I
> > get an external symbol rather than the data connected to it. How can I
show
> > all of the data connected to this object? So far the best I've come up
with
> > is to (dm show> ...) and use (show (: theproperty)) but I want to know
if
> > there's a more idiomatic way.
>
> If I understand you correctly, you are looking for a generic and
> reflective way to show all data, without having to write entity-specific
> methods, right?

That's correct unless there's nothing wrong or inefficient about how I use
(show...) within my (show> ...) method to display the data of a relation
instead of it's external symbol.

>
> The 'edit' function is remotely doing that, in that it shows the
> class(es) of the object(s) in a relation (and also decodes calendar
> dates). It doesn't show the individual properties of those objects,
> though, but recurses if you click on them with 'K'. In general, I would
> use 'edit' to browse graphs of database objects.

Yes this is very handy when building and debugging but won't help me
display the data in a GUI component.

>
> Otherwise, you could write a custom version of 'show' which displays all
> properties of the object using 'getl'. But I do not believe it will be
> visually appealing.

Agreed and a little over my head at this time to write anything more
generic than what you've already written.

>
>
> > Also how would I connect a (gui ...) component to such an object which
will
> > show all of the data of the object rather than external symbols ponting
to
> > relations?
>
> As gui components are typed, you would have to resort to a dumb text
> field or textarea to show things completely generically.

I like this idea of a dumb text field just displaying the data.  Can you
elaborate on this?

How about using
> the gui 'repl' function (which opens an interactive REPL in the browser,
> be careful about security issues!!) and then your 'show' from above? ;)

Cool!  I didn't even know about this.  I may use it for debugging but the
shell REPL is fine and I'm too paranoid worth security to let anyone else
have a REPL.

Thanks again for your help.
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: How to show data of relations rather than external symbol?

2014-06-29 Thread Alexander Burger
Hi David,

> If I have an +Entity with a +Joint to another +Entity and (show ...) it I
> get an external symbol rather than the data connected to it. How can I show
> all of the data connected to this object? So far the best I've come up with
> is to (dm show> ...) and use (show (: theproperty)) but I want to know if
> there's a more idiomatic way.

If I understand you correctly, you are looking for a generic and
reflective way to show all data, without having to write entity-specific
methods, right?

The 'edit' function is remotely doing that, in that it shows the
class(es) of the object(s) in a relation (and also decodes calendar
dates). It doesn't show the individual properties of those objects,
though, but recurses if you click on them with 'K'. In general, I would
use 'edit' to browse graphs of database objects.

Otherwise, you could write a custom version of 'show' which displays all
properties of the object using 'getl'. But I do not believe it will be
visually appealing.


> Also how would I connect a (gui ...) component to such an object which will
> show all of the data of the object rather than external symbols ponting to
> relations?

As gui components are typed, you would have to resort to a dumb text
field or textarea to show things completely generically. How about using
the gui 'repl' function (which opens an interactive REPL in the browser,
be careful about security issues!!) and then your 'show' from above? ;)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe