[comp.sys.next] ScrollView and Speaker/Listener questions and answers...

kamisett@enuxha.eas.asu.edu (Krishnaprasad Kamisetty) (12/12/90)

To: kamisett@enuxha.eas.asu.edu (Krishnaprasad Kamisetty)
Subject: Re: Database apps - HELP!!!
Newsgroups: comp.sys.next
In-Reply-To: <1820@enuxha.eas.asu.edu>
Organization: The Deep Thought Group, L.P.
Cc: 
Status: R

In article <1820@enuxha.eas.asu.edu> you write:
>Hi, 
>
>I need to do some programming project for a course.
>I thought I will use List class and make a simple database.
>I should be able to include all values into the database,
>retrieve them ofcourse, match on some entries and get subsets
>of the objects available in the DB.
>
>Are there any Examples out there that I could use? If any app.
>you know of uses List, please let me know. It will be extremely
>useful. Even if they are not so complete etc., it's ok!
>
>Thanks. Hope you have had a great holiday..
>
>-- 
>-Krishnaprasad
>Kris Kamisetty,CIM Systems Research,Dept. Of IE, ASU         
>e-mail: kamisett@enuxha.eas.asu.edu
>USmail: ERC 552,CIM Center,ASU,Tempe,AZ 85287-5106

Use the HashTable class instead.  For database access this will be
much faster and will scale better than List.  If you want to have
even better scaling, write a B-Tree class (or pick your favorite
flavor of B-tree) -- NeXT's 2.0 OS has a B*-Tree class, but I'm
not certain if it will be exposed.

The documentation on-line for HashTable should be pretty simple
to understand.  It is a key-value interface.  If you need additional
help, just send email.

Good luck.

Edward Jung                             The Deep Thought Group, L.P.
BIX: ejung                                     1518 1st Avenue South
UUCP: uunet!dtgcube!ed                     Seattle, Washington 98134
Internet: ed@dtg.com                                  (206) 343-5102


From droid!andrew@unmvax.cs.unm.edu Fri Dec  7 00:29:24 1990
Received: from unmvax.cs.unm.edu by enuxha.eas.asu.edu (5.61/1.28)
	id AA03346; Fri, 7 Dec 90 00:29:21 -0700
Received: from droid.UUCP by unmvax.cs.unm.edu (5.61/3.3) with UUCP
	id <AA03734@unmvax.cs.unm.edu>; Thu, 6 Dec 90 21:44:56 -0800
Received: by  (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0)
	id AA02289; Thu, 6 Dec 90 22:25:47 GMT-0700
Date: Thu, 6 Dec 90 22:25:47 GMT-0700
From: droid!andrew@unmvax.cs.unm.edu (Andrew Stone)
Message-Id: <9012070525.AA02289@>
Received: by NeXT Mailer (1.62)
To: enuxha.eas.asu.edu!kamisett@unmvax.cs.unm.edu (Krishnaprasad Kamisetty)
Subject: Re: Scroll View
Status: R

The Text object is what you are after, it is the "docView" of  
the ScrollView.

id text = [scrollView docView];
...
you can write the text or the rich text to a stream...

andrew

From windemut@paris.ks.uiuc.edu Fri Dec  7 01:31:18 1990
Received: from lisboa.ks.uiuc.edu by enuxha.eas.asu.edu (5.61/1.28)
	id AA03885; Fri, 7 Dec 90 01:31:14 -0700
Received: from  paris.ks.uiuc.edu  (paris) by  lisboa.ks.uiuc.edu  (NeXT-1.0 (From Sendmail 5.52)/NeXT-1.0)
	id AA02470; Fri, 7 Dec 90 02:32:10 CST
Received: by  paris.ks.uiuc.edu  (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0)
	id AA03089; Fri, 7 Dec 90 02:32:12 CST
Date: Fri, 7 Dec 90 02:32:12 CST
From: windemut@paris.ks.uiuc.edu (Andreas Windemuth)
Message-Id: <9012070832.AA03089@ paris.ks.uiuc.edu >
Received: by NeXT Mailer (1.50)
To: kamisett@enuxha.eas.asu.edu (Krishnaprasad Kamisetty)
Subject: Re: Scroll View
Cc: windemut@paris.ks.uiuc.edu
Status: R

What do you mean by "read the contents" ?
if you want to get the postscript code,

    NXRect bounds;
    

    [[scrollview docview] getBounds:&bounds];
    [[scrollview docview] copyPSCodeInside:&bounds to:stream];

should do the trick. If you want binary, likewise say

    [[scrollview docview] write:stream].

How do you get a file from a stream? That's not hard either.
This is a method of a View subclass that puts the postscript 

into a file:

- writeEPSFile:(const char *)fn
{
    NXStream *s;

    s = NXOpenMemory(NULL, 0, NX_WRITEONLY);
    [self copyPSCodeInside:&bounds to:s];
    if (NXSaveToFile(s, fn)<0) error("could not write %s.\n",fn);
    return self;
}

slightly modified for the scrollview situation:

{
    NXStream *s;
    NXRect bounds;
    id view;
    

    s = NXOpenMemory(NULL, 0, NX_WRITEONLY);
    view=[scrollview docview]
    [view getBounds:&bounds];
    [view copyPSCodeInside:&bounds to:s];
    if (NXSaveToFile(s, fn)<0) [self error:"could not write %s.\n",fn];
    return self;
}

Hope this helps
    

Andreas Windemuth
Theoretical Biophysics
3121 Beckman Institute, University of Illinois at Urbana-Champaign

From windemut@paris.ks.uiuc.edu Fri Dec  7 10:35:24 1990
Received: from lisboa.ks.uiuc.edu by enuxha.eas.asu.edu (5.61/1.28)
	id AA17275; Fri, 7 Dec 90 10:35:16 -0700
Received: from  paris.ks.uiuc.edu  (paris) by  lisboa.ks.uiuc.edu  (NeXT-1.0 (From Sendmail 5.52)/NeXT-1.0)
	id AA03105; Fri, 7 Dec 90 11:36:09 CST
Received: by  paris.ks.uiuc.edu  (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0)
	id AA03307; Fri, 7 Dec 90 11:36:12 CST
Date: Fri, 7 Dec 90 11:36:12 CST
From: windemut@paris.ks.uiuc.edu (Andreas Windemuth)
Message-Id: <9012071736.AA03307@ paris.ks.uiuc.edu >
Received: by NeXT Mailer (1.50)
To: kamisett@enuxha.eas.asu.edu (Krishnaprasad Kamisetty)
Subject: Re: Scroll View
Cc: windemut@paris.ks.uiuc.edu
Status: R


Well, in this case the docView of your ScrollView is
a Text. I believe you can extract the text inside a Text 

object by a simple method call. look it up under Text
in NextDev. Then append it to a file as you would do in 

standard unix programming. There will probably also
be a method to turn the text into a NXStream, that would
be much more convenient, as you would not have to allocate 

a potentially very long string. Remember that
[scrollview docview] (or similar) gets you the relevant
Text object.
	Good Luck,
	
			Andreas


From droid!andrew@unmvax.cs.unm.edu Fri Dec  7 10:53:22 1990
Received: from unmvax.cs.unm.edu by enuxha.eas.asu.edu (5.61/1.28)
	id AA18358; Fri, 7 Dec 90 10:53:17 -0700
Received: from droid.UUCP by unmvax.cs.unm.edu (5.61/3.3) with UUCP
	id <AA11835@unmvax.cs.unm.edu>; Fri, 7 Dec 90 09:53:21 -0800
Received: by  (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0)
	id AA03334; Fri, 7 Dec 90 10:54:22 GMT-0700
Date: Fri, 7 Dec 90 10:54:22 GMT-0700
From: droid!andrew@unmvax.cs.unm.edu (Andrew Stone)
Message-Id: <9012071754.AA03334@>
Received: by NeXT Mailer (1.62)
To: enuxha.eas.asu.edu!kamisett@unmvax.cs.unm.edu (Krishnaprasad Kamisetty)
Subject: Re: Scroll View
Status: R

here is some stuff that might help:
#import <appkit/SavePanel.h>
#import <appkit/nextstd.h>

// maybe other includes too...


- exportText:sender
{
	id savepanel = [SavePanel new];
	
	[savepanel setRequiredFileType:NULL];
	if ([savepanel runModalForDirectory:NULL file:NULL]) {
		([self saveTextDocument:[savepanel filename]]; 
	}
 

	return self;
}
- (BOOL)saveTextDocument:(const char *)fileName
{
    BOOL saveOK;
    int fd;     // File descriptor
    NXStream *stream = NULL;
    if (saveOK =(((fd=open(fileName,O_WRONLY|O_CREAT|O_TRUNC,  
0644)) != -1) &&
            (stream = NXOpenFile (fd, NX_WRITEONLY)))) {
	    

	  [[scrollView docView] writeRichText:stream];
	}
    if (stream) NXClose(stream);
    if (fd != -1) close (fd);
	return saveOK;
}

From hitt@Neon.Stanford.EDU Sat Dec  8 10:51:58 1990
Received: from Neon.Stanford.EDU by enuxha.eas.asu.edu (5.61/1.28)
	id AA17666; Sat, 8 Dec 90 10:51:51 -0700
Received:  by Neon.Stanford.EDU (5.61/25-eef) id AA20265; Sat, 8 Dec 90 09:52:35 -0800
Date: Sat, 8 Dec 90 09:52:35 -0800
From: Daniel Hitt <hitt@Neon.Stanford.EDU>
Message-Id: <9012081752.AA20265@Neon.Stanford.EDU>
To: kamisett@enuxha.eas.asu.edu
Subject: Re:  Waiting between Commands...Help.
Cc: hitt@Neon.Stanford.EDU
Status: R

Does authWindow stand for author window or authentication window?

In any event, what you can do after opening it and making it front is
     [NXApp runModalFor:authWindow];
This will transfer all input to authWindow, or more exactly, authWindow
will be the only window in your application which will get any events
from the window manager (as i understand it).

Now, in authWindow, you'll have a button called OK or Cancel or
something, i imagine, and for the action called for that button,
you need some code like
     [NXApp stopModal];
and if you want to get rid of authWindow at that point, you'd also
have
     [authWindow close];

I've used code like this in several programs, when it is necessary
to get input from the user of a certain kind, and no further work
can be done until that input is gotten.

dan

From joerg1@husc9.harvard.edu Sat Dec  8 18:17:00 1990
Received: from husc9.harvard.edu by enuxha.eas.asu.edu (5.61/1.28)
	id AA14838; Sat, 8 Dec 90 18:16:55 -0700
Date: Sat, 8 Dec 90 20:17:12 EST
From: joerg1@husc9.harvard.edu (Dave Joerg)
Message-Id: <9012090117.AA25182@husc9.harvard.edu>
To: joerg@alliant.mcs.anl.gov, kamisett@enuxha.eas.asu.edu
Subject: Re:  Speaker/Listener
Status: R

 I don't think you can do it.  As far as I know, the only public message
Librarian is prepared to receive with regards to doing searches, is the
message that tells Librarian to look up a particular word.  What's more,
even that message doesn't actually return any data to the message-sending
App; Librarian simply looks up the word requested and displays the data
in its window.
 Now, perhaps the makers of Librarian did put some more sophisticated (and
useful) messaging capabilities into their App, but if such an interface
exists, I'm not aware of it.
 Also, perhaps 2.0 App's have more extensive message-passing capabilities,
but I haven't received 2.0 yet.

 Good luck with your project,

 Dave Joerg
joerg1@husc9.harvard.edu


-- 
-Krishnaprasad
Kris Kamisetty,CIM Systems Research,Dept. Of IE, ASU         
e-mail: kamisett@enuxha.eas.asu.edu
USmail: ERC 552,CIM Center,ASU,Tempe,AZ 85287-5106