Ok, I'm connected to the public store but I don't see where to get the
ExternalProcessStreams package. I've checked out all of the Store menu in the Visual Launcher. I must be missing something (besides my incompetence). Dan -----Original Message----- From: Terry Raymond [mailto:[hidden email]] Sent: Friday, August 24, 2007 11:21 AM To: 'Daniel Klein'; [hidden email] Subject: RE: Using ExternalProcess? Daniel http://www.cincomsmalltalk.com/CincomSmalltalkWiki/Public+Store+Repository Terry =========================================================== Terry Raymond Crafted Smalltalk 80 Lazywood Ln. Tiverton, RI 02878 (401) 624-4517 [hidden email] <http://www.craftedsmalltalk.com> =========================================================== > -----Original Message----- > From: Daniel Klein [mailto:[hidden email]] > Sent: Friday, August 24, 2007 11:12 AM > To: [hidden email] > Subject: RE: Using ExternalProcess? > > Please excuse my inexperience but where is the 'public store' ? > > Daniel Klein > > -----Original Message----- > From: Michael Lucas-Smith [mailto:[hidden email]] > Sent: Friday, August 24, 2007 8:31 AM > To: Daniel Klein > Cc: [hidden email] > Subject: Re: Using ExternalProcess? > > ExternalProcessStreams is a package in public store. > > I've had previous reports of situations where using the API in this > package fails. If you try it and you do have a failure - please post it > back to this thread. > > Michael > > > Daniel Klein wrote: > > I went looking for this cos I have a need for it too. Are 'External', > > 'Process', 'Streams' packages, bundles, classes, ???. > > > > Where is it? > > > > Daniel Klein > > > > > > -----Original Message----- > > From: Michael Lucas-Smith [mailto:[hidden email]] > > Sent: Thursday, August 23, 2007 3:04 PM > > To: Carl Gundel > > Cc: [hidden email] > > Subject: Re: Using ExternalProcess? > > > > Carl Gundel wrote: > > > >> ExternalProcess defaultClass cshOne: 'some command' > >> > >> The cshOne: method is very cool for single shot commands, but how > >> would I use ExternalProcess with an interactive program like mail or > ftp? > >> > > Try External-Process-Streams - this strips away the need to use the > > command shell to do piping in/out of applications. So it works on > > Windows like it does on Unix - it has a common API across all platforms. > > > > > > > > |
You'll have to excuse our current UI work flow - it needs some work. Now
you right click on the store area down the bottom of the launcher and pick "Browse Published Items". From there you'll be presented with a window filled with all the packages and bundles in the public repository. Type in "ExternalProcess" and about then the right package should appear - ExternalProcessStreams. Click on that, then click on the latest version on the right hand side, right click on it and pick Load. Cheers, Michael Daniel Klein wrote: > Ok, I'm connected to the public store but I don't see where to get the > ExternalProcessStreams package. I've checked out all of the Store menu in > the Visual Launcher. I must be missing something (besides my incompetence). > > Dan > > -----Original Message----- > From: Terry Raymond [mailto:[hidden email]] > Sent: Friday, August 24, 2007 11:21 AM > To: 'Daniel Klein'; [hidden email] > Subject: RE: Using ExternalProcess? > > Daniel > > http://www.cincomsmalltalk.com/CincomSmalltalkWiki/Public+Store+Repository > > Terry > > =========================================================== > Terry Raymond > Crafted Smalltalk > 80 Lazywood Ln. > Tiverton, RI 02878 > (401) 624-4517 [hidden email] > <http://www.craftedsmalltalk.com> > =========================================================== > >> -----Original Message----- >> From: Daniel Klein [mailto:[hidden email]] >> Sent: Friday, August 24, 2007 11:12 AM >> To: [hidden email] >> Subject: RE: Using ExternalProcess? >> >> Please excuse my inexperience but where is the 'public store' ? >> >> Daniel Klein >> >> -----Original Message----- >> From: Michael Lucas-Smith [mailto:[hidden email]] >> Sent: Friday, August 24, 2007 8:31 AM >> To: Daniel Klein >> Cc: [hidden email] >> Subject: Re: Using ExternalProcess? >> >> ExternalProcessStreams is a package in public store. >> >> I've had previous reports of situations where using the API in this >> package fails. If you try it and you do have a failure - please post it >> back to this thread. >> >> Michael >> >> >> Daniel Klein wrote: >> >>> I went looking for this cos I have a need for it too. Are 'External', >>> 'Process', 'Streams' packages, bundles, classes, ???. >>> >>> Where is it? >>> >>> Daniel Klein >>> >>> >>> -----Original Message----- >>> From: Michael Lucas-Smith [mailto:[hidden email]] >>> Sent: Thursday, August 23, 2007 3:04 PM >>> To: Carl Gundel >>> Cc: [hidden email] >>> Subject: Re: Using ExternalProcess? >>> >>> Carl Gundel wrote: >>> >>> >>>> ExternalProcess defaultClass cshOne: 'some command' >>>> >>>> The cshOne: method is very cool for single shot commands, but how >>>> would I use ExternalProcess with an interactive program like mail or >>>> >> ftp? >> >>> Try External-Process-Streams - this strips away the need to use the >>> command shell to do piping in/out of applications. So it works on >>> Windows like it does on Unix - it has a common API across all platforms. >>> >>> >>> >>> >>> > > > > > |
In reply to this post by Carl Gundel
Technically the standard way of opening Published Items is via the Store menu in the Launcher, the gadget at the bottom came later. |
In reply to this post by Michael Lucas-Smith-2
Thanks you Michael for the clear and consise instructions.
No need to change the gui; just add these instructions to: http://www.cincomsmalltalk.com/CincomSmalltalkWiki/Public+Store+Repository Dan -----Original Message----- From: Michael Lucas-Smith [mailto:[hidden email]] Sent: Saturday, August 25, 2007 9:10 AM To: Daniel Klein Cc: [hidden email] Subject: Re: Using ExternalProcess? You'll have to excuse our current UI work flow - it needs some work. Now you right click on the store area down the bottom of the launcher and pick "Browse Published Items". From there you'll be presented with a window filled with all the packages and bundles in the public repository. Type in "ExternalProcess" and about then the right package should appear - ExternalProcessStreams. Click on that, then click on the latest version on the right hand side, right click on it and pick Load. Cheers, Michael Daniel Klein wrote: > Ok, I'm connected to the public store but I don't see where to get the > ExternalProcessStreams package. I've checked out all of the Store menu in > the Visual Launcher. I must be missing something (besides my incompetence). > > Dan > > -----Original Message----- > From: Terry Raymond [mailto:[hidden email]] > Sent: Friday, August 24, 2007 11:21 AM > To: 'Daniel Klein'; [hidden email] > Subject: RE: Using ExternalProcess? > > Daniel > > http://www.cincomsmalltalk.com/CincomSmalltalkWiki/Public+Store+Repository > > Terry > > =========================================================== > Terry Raymond > Crafted Smalltalk > 80 Lazywood Ln. > Tiverton, RI 02878 > (401) 624-4517 [hidden email] > <http://www.craftedsmalltalk.com> > =========================================================== > >> -----Original Message----- >> From: Daniel Klein [mailto:[hidden email]] >> Sent: Friday, August 24, 2007 11:12 AM >> To: [hidden email] >> Subject: RE: Using ExternalProcess? >> >> Please excuse my inexperience but where is the 'public store' ? >> >> Daniel Klein >> >> -----Original Message----- >> From: Michael Lucas-Smith [mailto:[hidden email]] >> Sent: Friday, August 24, 2007 8:31 AM >> To: Daniel Klein >> Cc: [hidden email] >> Subject: Re: Using ExternalProcess? >> >> ExternalProcessStreams is a package in public store. >> >> I've had previous reports of situations where using the API in this >> package fails. If you try it and you do have a failure - please post it >> back to this thread. >> >> Michael >> >> >> Daniel Klein wrote: >> >>> I went looking for this cos I have a need for it too. Are 'External', >>> 'Process', 'Streams' packages, bundles, classes, ???. >>> >>> Where is it? >>> >>> Daniel Klein >>> >>> >>> -----Original Message----- >>> From: Michael Lucas-Smith [mailto:[hidden email]] >>> Sent: Thursday, August 23, 2007 3:04 PM >>> To: Carl Gundel >>> Cc: [hidden email] >>> Subject: Re: Using ExternalProcess? >>> >>> Carl Gundel wrote: >>> >>> >>>> ExternalProcess defaultClass cshOne: 'some command' >>>> >>>> The cshOne: method is very cool for single shot commands, but how >>>> would I use ExternalProcess with an interactive program like mail or >>>> >> ftp? >> >>> Try External-Process-Streams - this strips away the need to use the >>> command shell to do piping in/out of applications. So it works on >>> Windows like it does on Unix - it has a common API across all platforms. >>> >>> >>> >>> >>> > > > > > |
In reply to this post by Nowak, Helge
The following script reproduces a problem I'm having reading contents of a
file. The value of the length variable agrees with the OS about the file size, but when I try to read that many characters there aren't that many there. I get an "Unhandled exception: not enough elements available". | rs length string | rs := 'c:\myfile.txt' asFilename readStream. [ length := rs size. string := rs next: length ] ensure: [ rs close ]. string Any ideas? -Carl Gundel http://www.runbasic.com |
Try reading it in #binary instead. It may be the character encoding for
the stream is in play here. Michael Carl Gundel wrote: > The following script reproduces a problem I'm having reading contents > of a file. The value of the length variable agrees with the OS about > the file size, but when I try to read that many characters there > aren't that many there. I get an "Unhandled exception: not enough > elements available". > > | rs length string | > rs := 'c:\myfile.txt' asFilename readStream. > [ > length := rs size. > string := rs next: length ] ensure: [ rs close ]. > string > > Any ideas? > > -Carl Gundel > http://www.runbasic.com > > |
In reply to this post by Carl Gundel
Also, use #contents, its a nicer shortcut. |
In reply to this post by Michael Lucas-Smith-2
Or even more likely the line end convention. In CRLF mode (Windows) each CR takes two bytes.
Michael Lucas-Smith wrote: > Try reading it in #binary instead. It may be the character encoding for > the stream is in play here. > > Michael > > Carl Gundel wrote: >> The following script reproduces a problem I'm having reading contents >> of a file. The value of the length variable agrees with the OS about >> the file size, but when I try to read that many characters there >> aren't that many there. I get an "Unhandled exception: not enough >> elements available". >> >> | rs length string | >> rs := 'c:\myfile.txt' asFilename readStream. >> [ >> length := rs size. >> string := rs next: length ] ensure: [ rs close ]. >> string >> >> Any ideas? >> >> -Carl Gundel >> http://www.runbasic.com >> >> > > |
In reply to this post by Michael Lucas-Smith-2
That helps in that it works when I do it. However I need to be in text mode
when I do this. It seems to be losing a character for each line of text in the file. It makes my code really ugly to have to be doing all this with byte values instead of strings and characters. :-( When working in binary mode it sure would be helpful if the stream was smart enough to work with strings and characters. -Carl Gundel http://www.runbasic.com From: "Michael Lucas-Smith" <[hidden email]> > Try reading it in #binary instead. It may be the character encoding for > the stream is in play here. > > Carl Gundel wrote: >> The following script reproduces a problem I'm having reading contents of >> a file. The value of the length variable agrees with the OS about the >> file size, but when I try to read that many characters there aren't that >> many there. I get an "Unhandled exception: not enough elements >> available". >> >> | rs length string | >> rs := 'c:\myfile.txt' asFilename readStream. >> [ >> length := rs size. >> string := rs next: length ] ensure: [ rs close ]. >> string >> >> Any ideas? >> >> -Carl Gundel >> http://www.runbasic.com >> >> > > |
No sure why you care?? If its really a .txt content file, then reading
converts the windows CR/LF to the VW internal "CR" (so you lose one char). If you then write it out to a windows file the CR gets converted back to CR/LF. If you really want to see the CR and the LF as separate characters, you can do that too by changing the lineEnd mode. You might try "stream lineEndTransparent" -- but remember then that you will be seeing different things from files on different platforms (LF for unix, CR/LF for windows, CR for mac). Carl Gundel wrote: > That helps in that it works when I do it. However I need to be in > text mode when I do this. It seems to be losing a character for each > line of text in the file. It makes my code really ugly to have to be > doing all this with byte values instead of strings and characters. :-( > > When working in binary mode it sure would be helpful if the stream was > smart enough to work with strings and characters. > > -Carl Gundel > http://www.runbasic.com > > From: "Michael Lucas-Smith" <[hidden email]> >> Try reading it in #binary instead. It may be the character encoding >> for the stream is in play here. >> >> Carl Gundel wrote: >>> The following script reproduces a problem I'm having reading >>> contents of a file. The value of the length variable agrees with >>> the OS about the file size, but when I try to read that many >>> characters there aren't that many there. I get an "Unhandled >>> exception: not enough elements available". >>> >>> | rs length string | >>> rs := 'c:\myfile.txt' asFilename readStream. >>> [ >>> length := rs size. >>> string := rs next: length ] ensure: [ rs close ]. >>> string >>> >>> Any ideas? >>> >>> -Carl Gundel >>> http://www.runbasic.com >>> >>> >> >> > > -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 sip:[hidden email] Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP |
> No sure why you care??
I care because I need to work in text mode, and I would like the size of the stream to agree with the actual number of characters in it. So Michael suggested I switch to binary mode. Fair enough except that now I need to be constantly converting between strings and byte arrays. That makes my code really ugly (and probably buggy), and inefficient. I use VW to implement a flavor of BASIC, and BASIC programmers are used to being able to do this: 'read an entire file into text$ open "myfile.txt" for input as #readthis length = lof(#readthis) text$ = input$(#readthis, length) close The VW version looks something like this: | rs length string | rs := 'myfile.txt' asFilename readStream. [ length := rs size. string := rs next: length ] ensure: [ rs close ] If I do this in VW I get an error. If I use binary mode if doesn't give me the error, but then everything else I do is difficult. My implementation in VisualSmalltalk doesn't give me these issues. If I open a binary file I can still read/write usings strings. > If its really a .txt content file, then reading converts the windows CR/LF > to > the VW internal "CR" (so you lose one char). If you then write it out to > a windows file the CR gets converted > back to CR/LF. Yes, but I'm not taking issue with this. Like I said, I would like the size of the stream to agree with the actual number of characters in it. Is it a big deal? I'm not sure, but it isn't fun to jump through hoops like this. -Carl |
Carl Gundel wrote: >> No sure why you care?? > > I care because I need to work in text mode, and I would like the size > of the stream to agree with the actual number of characters in it. > > So Michael suggested I switch to binary mode. Fair enough except that > now I need to be constantly converting between strings and byte > arrays. That makes my code really ugly (and probably buggy), and > inefficient. > > I use VW to implement a flavor of BASIC, and BASIC programmers are > used to being able to do this: > > 'read an entire file into text$ > open "myfile.txt" for input as #readthis > length = lof(#readthis) > text$ = input$(#readthis, length) > close > > The VW version looks something like this: > > | rs length string | > rs := 'myfile.txt' asFilename readStream. > [ > length := rs size. > string := rs next: length ] ensure: [ rs close ] > > If I do this in VW I get an error. If I use binary mode if doesn't > give me the error, but then everything else I do is difficult. My > implementation in VisualSmalltalk doesn't give me these issues. If I > open a binary file I can still read/write usings strings. > >> If its really a .txt content file, then reading converts the windows >> CR/LF to >> the VW internal "CR" (so you lose one char). If you then write it >> out to a windows file the CR gets converted >> back to CR/LF. > > Yes, but I'm not taking issue with this. Like I said, I would like > the size of the stream to agree with the actual number of characters > in it. > > Is it a big deal? I'm not sure, but it isn't fun to jump through > hoops like this. its a problem. If you don't care about having the CR and the LF (which could create problems in processing the lines perhaps, depending on what you want to do), setting "stream lineEndTransparent" will likely solve the specific problem of having the file size match the file. Otherwise, I guess you could read the whole file to find the length?? > > > -Carl > -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 sip:[hidden email] Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP |
In reply to this post by Carl Gundel
For size to agree with characters you would need to read the whole stream with respect to steam encoding and line end conversion anyway so might as well use contents size. In the meantime switch to lineEndTransparent if you want to read cr and lf as their own characters, it will then match the byte size of a stream. I'm not sure what will happen when you have multibyte chars in the stream. |
Thanks for everyone for the feedback. I decided to do what Boris suggested
about using contents size. I managed to make this work for my particular case. -Carl Gundel http://www.runbasic.com From: "Boris Popov" <[hidden email]> > For size to agree with characters you would need to read the whole stream > with respect to steam encoding and line end conversion anyway so might as > well use contents size. In the meantime switch to lineEndTransparent if > you want to read cr and lf as their own characters, it will then match the > byte size of a stream. I'm not sure what will happen when you have > multibyte chars in the stream. |
In reply to this post by Carl Gundel
Carl Gundel escreveu:
>> No sure why you care?? > > I care because I need to work in text mode, and I would like the size of > the stream to agree with the actual number of characters in it. > > So Michael suggested I switch to binary mode. Fair enough except that > now I need to be constantly converting between strings and byte arrays. > That makes my code really ugly (and probably buggy), and inefficient. > > I use VW to implement a flavor of BASIC, and BASIC programmers are used > to being able to do this: > > 'read an entire file into text$ > open "myfile.txt" for input as #readthis > length = lof(#readthis) > text$ = input$(#readthis, length) > close > > The VW version looks something like this: > > | rs length string | > rs := 'myfile.txt' asFilename readStream. > [ > length := rs size. > string := rs next: length ] ensure: [ rs close ] > > If I do this in VW I get an error. If I use binary mode if doesn't give > me the error, but then everything else I do is difficult. My > implementation in VisualSmalltalk doesn't give me these issues. If I > open a binary file I can still read/write usings strings. > >> If its really a .txt content file, then reading converts the windows >> CR/LF to >> the VW internal "CR" (so you lose one char). If you then write it out >> to a windows file the CR gets converted >> back to CR/LF. > > Yes, but I'm not taking issue with this. Like I said, I would like the > size of the stream to agree with the actual number of characters in it. > > Is it a big deal? I'm not sure, but it isn't fun to jump through hoops > like this. > Carl, I'm sure you've already been suggested to do so, but taking your example as is, what's wrong with: | rs string | rs := 'myfile.txt' asFilename readStream. string := rs contents. if you *really* need the size of the text for using in BASIC, then: length := string size. HTH -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ |
In reply to this post by Carl Gundel
There's also #contentsOfEntireFile to save you from opening and closing the stream youself. |
Hi,
When i try to open a window with a ToolBar, inside the subcanvas of another window the ToolBar is not displayed. I experienced the same problem for MenuBar also. Is it some problem of the way i open the windows in subcanvas? Do anyone have such experience? Any hint or suggestion for a solution will be greatly helpful. Thanks in advance, maNi |
I did a screencast on this topic, as I wanted to add a toolbar to a
subcanvas in BottomFeeder. See: http://www.cincomsmalltalk.com/casts/stDaily/2007/smalltalk_daily-06-05-07.html and: http://www.cincomsmalltalk.com/userblogs/cincom/blogView?content=smalltalk_daily for all of "Smalltalk Daily" ----- Original Message ----- From: "Mani S Kartha" <[hidden email]> To: <[hidden email]> Sent: Tuesday, September 04, 2007 12:21 AM Subject: [VW7.4.1]menuBar/ToolBar in Subcanvas > Hi, > > When i try to open a window with a ToolBar, inside the subcanvas of > another window the ToolBar is not displayed. > I experienced the same problem for MenuBar also. > Is it some problem of the way i open the windows in subcanvas? > Do anyone have such experience? > Any hint or suggestion for a solution will be greatly helpful. > Thanks in advance, > > maNi > > > > > |
In reply to this post by Carl Gundel
Carl, You might consider something like these. Cheers, -cstb At 01:18 PM 9/3/2007, Carl Gundel wrote: ... >I use VW to implement a flavor of BASIC, and BASIC programmers are used to being able to do this: > > 'read an entire file into text$ > open "myfile.txt" for input as #readthis > length = lof(#readthis) > text$ = input$(#readthis, length) > close > >The VW version looks something like this: >>readFile: filenameOrString ^self input: filenameOrString asString asFilename length: nil >>input: streamable length: count | rs | rs := streamable readStream. ^[ rs nextAvailable: (count orIfNil: [rs size]) ] ensure: [ rs close ] String>>asString ^self Object>>orIfNil: a0block ^self UndefinedObject>>orIfNil: a0block ^a0block value === |
In reply to this post by Nowak, Helge
When I package my Seaside application RuntimeEmergencyNotifier is the error
notifier that gets used by default. Of course I don't really want to use this because any unhandled exceptions will cause the server to quit. What would be a better choice for use with a packaged Seaside app? -Carl Gundel http://www.runbasic.com |
Free forum by Nabble | Edit this page |