MC vs LabVIEW (was Passing keypress messages to other applications)

2003-08-18 Thread Dar Scott
On Monday, August 18, 2003, at 02:59 PM, Newendorp Bruce C wrote:

I am using MetaCard with an external dll to monitor the status of the 
inputs of a National Instruments data acquisition card.
This does not apply to your question.  I like Ken's answer.

I am curious.  Did you chose MetaCard over LabVIEW from NI?  Or where 
you already down the MetaCard path?  Or did you completely ignore the 
existence of LaVIEW?

I like LabVIEW, though I don't like recent changes.  I want 
multiplatform, which is OK on LabVIEW but, for me, expensive with 
LabVIEW.  I hope to eventually build up a labVIEW-like capability using 
Revolution where I get all platforms (with the level I bought).

Dar Scott


Dar Scott Consulting
http://www.swcp.com/dsc/
Programming Services

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Script Limits vs dynamic programming

2003-08-14 Thread Dar Scott
On Thursday, August 7, 2003, at 04:31 PM, Dr. John R. Vokey wrote:

Thus, rather being an essential part of metacard/RR, this dynamism 
becomes a feature *only* licensed users (developers?) can use, but 
can't retain in the stacks they produce.  By all means, strip it out 
of standalones if need be, but leave it as an essential feature of 
stacks.
I'm not sure I'm following this.

To be used, a stack needs to be either in a standalone, used by a 
standalone, run by an engine or used in a development environment.  In 
the past there was the free version that--like the standalone--was 
unlicensed.  It could run stacks but in doing so was limited in set 
the script of ... capability to 10 lines.

So, the limit is not in the stack but in the environment and in the 
intended use of the stack.  In some sense (and perhaps in a real sense) 
the engine is just a naked standalone.  It is the player that is 
handicapped to license or don't set the script.

Or am I completely missing your point?

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Script Limits

2003-08-14 Thread Dar Scott
On Tuesday, August 5, 2003, at 04:29 PM, Shari wrote:

What would this affect?  Presumably if we create a standalone, and  
distribute it, this would affect scripts within the standalone,  
correct?
It is my understanding that these are OK.  The limit of 0 for  
standalones would apply to 'set the script of ... during the execution  
of the standalone.  If you don't do that in your scripts, then you are  
OK.

Right now a standalone can have unlimited lines in the script, but not  
in a do command.  I don't know about other folks, but I use the do  
command a LOT in my standalones.  Even with the 10 line limit.
It is not clear to me what the 'do' limit will be.  I expect it will  
remain at 10 or increase, but we will have to wait and see.

Dar Scott

 

  Dar Scott Consultinghttp://www.swcp.com/dsc/Programming  
Services
 


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: A task for Binary decode?

2003-08-14 Thread Dar Scott
On Tuesday, August 12, 2003, at 03:22 PM, jbv wrote:

At first glance, the data looks like octal (base 8), and therefore
...
But I'm somewhat puzzled by things like Exif or MM in the
code...
It may be that the binary blob was forced to ASCII printable to be 
saved in the database.  Those bytes that are already in that range, 
such as MM are left as they are.  It looks like there might be some 
null terminated strings in the data, also, and those are printable 
ASCII.  I suspect that those bytes outside the printable ASCII range 
are encoded as \nnn where nnn is the octal representation of the byte.

If so, the conversion from the database form to the raw binary may 
simply be this:

   put format(asciifiedData) into binaryData

I didn't see any indication of this, but there might be some constraint 
as to a maximum line length in the database and some line-end is 
inserted to comply.  Those should be removed before the format() is 
applied.

The binary data is then available for use as binary as a whole.  If 
parts are needed, then binaryDecode() can be used, but if not, then it 
will not be needed.

Dar Scott

Dar Scott Consulting
http://www.swcp.com/dsc/
Programming Services

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Script Limits

2003-08-09 Thread Dar Scott
On Wednesday, August 6, 2003, at 02:56 PM, jbv wrote:

I'm afraid this script limit thing might be the first of a long
list of unexpected (and undocumented / unexplained) changes,
and discussions about them might clutter this list in coming
weeks...
I confess that this news hit me pretty hard; we got the same news on 
the Revolution list.  However, there always has to be a first mention.  
This mail is much better than finding an engine doesn't work as 
expected after downloading it.

There is no indication that this change will be undocumented.

Last but not least, I think that getting messages from Kevin
saying we're working on this and that... If anyone has any
objections to this, please contact me off list. isn't the best
strategy / politics to convince MC users to upgrade to Rev...
In best light, I think we can see that Kevin is giving folks a heads-up 
on what is coming.  It also indicates that Kevin is desiring to work 
with people who currently have standalone product that will be affected 
by this.  Knowing Kevin, I expect things can be worked out.

I agree that the 'off list' part may give an impression of dampening 
discussion of bad news and I can only guess of Kevin's motives there.

I agree that this news along with licensing changes can make one wonder 
about the future.

Dar Scott
kibitzing rev user


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Script Limits

2003-08-07 Thread Dar Scott
On Thursday, August 7, 2003, at 01:03 PM, David Bovill wrote:

The classic reason for not doing this is the fear that it will undercut
the market for the full product. This fear is completely unfounded. It
is also completely un-Scottish.
I think this so, but I mention it with hesitation, because I respect 
RunRev's analysis.

Consider this scenario comparison (numbers off by several orders of 
magnitude):

With free version--
18,000,000 free version users in 2006
2,500,000 licensed version users in 2006
Cost to support free version $15,000 in 2006
Without free version--
20,000 free version users in 2006
90,000 licensed version users in 2006
Cost to fight free versions:  $150,000 in 2006
All of those numbers might be way off, I have not given this much 
consideration, but they should reflect my gut feel in this, which may 
not have any value at all.  My gut feel says my gut feel has no sense.

Dar Scott
I hear I'm part Scottish.  I think I'm probably related to St. Patrick 
and Adam Smith and some of those guys portrayed in the movies wearing 
blue.  And I shout Freedom! whenever I'm tortured.  (OK, Patrick was 
Roman-Scottish and lived mostly in Ireland, but I still claim him as a 
relative.)





___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Multiple LAN cards mc server apps

2003-08-03 Thread Dar Scott
On Sunday, August 3, 2003, at 06:30 AM, LiangTyan Fui wrote:


2. How do you restrict metacard listening to just one interface?
Not that I know :(
If you don't need the port on the undesired interfaces for some other
service, you can block them with a local-machine firewall.
Unfortunately this is not always the case. For example I have MetaCard  
based
SMTP server listen on port 25 to handle incoming traffic, and still  
would
like to run sendmail on the loop back 127.0.0.1 for local traffic.
By accepting connections on port 25 using metacard, I cannot start  
sendmail
anymore.
I have run into exactly the same problem.  It would be nice to be more  
specific in the listen.  Perhaps the ability to optionally specify the  
IP address would do it.  (And at the same time allow a connectionID to  
differentiate TCP listening from UDP listening in openSockets().)

Dar Scott

 

  Dar Scott Consultinghttp://www.swcp.com/dsc/Programming  
Services
 


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Controlling/comunicating w/ USB devices

2003-07-18 Thread Dar Scott
On Friday, July 18, 2003, at 07:14 AM, Ben Rubinstein wrote:

In terms of explicitly talking to a USB device, everyone who asks is  
told to
use the open driver command; but followup questions about what to  
pass to
it - ie the driverName - appear to have gone unanswered.
I know you are searching for positive answers, Ben, but I am suspecting  
more and more the answer is no.  Maybe this rash statement will  
inspire someone to show a counter example.

I would think that the supplier of the device would have drivers.  You  
might need to make an external.  It that is on the wrong platform, you  
might need to set up some network communications to get control to the  
right one.  That sure looks like a lot of work.

Dar Scott
 

  Dar Scott Consultinghttp://www.swcp.com/dsc/Programming  
Services
 


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Serial (was Controlling/comunicating...)

2003-07-18 Thread Dar Scott
On Friday, July 18, 2003, at 07:03 AM, [EMAIL PROTECTED] wrote:

If you are interested in opening a serial port on a usb device, I can
tell you more.

I would be very interested in this information.  Since the new Macs  
have eliminated the old serial port and are using internal USB modems,  
I'm not able to access these
modems because they don't present themselves as MODEM: or PRINTER:  
and those are the only options I have in MC/RR.
The internal modem on my MDD is not USB and I don't think it is on my  
Blue  White.

OK, here is a short summary:

Mac OS 9.2

Only printer: and modem: can be opened.  Use open file.  I hear you  
map a USB serial port to printer: to be able to open it.  (This does  
not work for me, I get sysError()=-98; perhaps this is because I  
already have a phantom printer: port.  I may have gotten it to open  
once.)  The write blocks.

OS X

There are a few problems, some of which will be fixed in the upcoming  
release.

Internal Modem:
It takes about 3 seconds to open or close.  (I don't know if this is a  
bug or some FCC regulation.)  This works best:
open driver ... for binary update
write ... driver ... -- as needed
read ... driver  ... until /* buffer is */ empty -- as needed
close driver ...

I don't mean to imply you should close and reopen after each  
write-read; I mean use those methods.

USB-to-serial adaptor
This works best:
open driver ... for binary update
write data-that-ends-in-LF to driver ... -- as needed
read ... driver ... until /* buffer is */ empty  -- as needed
close driver ...
The write is non-blocking, so take care to avoid closing too soon.  You  
also need to pace output to prevent output overruns; if your  
application sends a line, waits for a response and then repeats, you  
should be OK.

The driverNames() does not include the internal modem, but will in the  
next release.

The handshake controls in serialControlString do nothing.

Window XP

You can open driver or open file to COMx: or \\.\COMx, but  
serialControlString applies only to the first.  Write will block for up  
to 2 seconds, so keep it to simple dialogs.  I use only read until  
empty.  Basic handshaking control works.  (No USB testing, yet.)

Linux

I haven't tested any yet, but I understand serialControlString is now  
implemented.

Dar Scott

 

  Dar Scott Consultinghttp://www.swcp.com/dsc/Programming  
Services
 


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Controlling/comunicating w/ USB devices

2003-07-17 Thread Dar Scott
On Thursday, July 17, 2003, at 08:50 AM, Ben Rubinstein wrote:

More generally, has anyone yet managed to communicate
with a USB device in MetaCard or Rev - and if so, could they share 
their
experience?
I have opened a serial port implemented on a usb device, but I have not 
opened a control pipe (or whatever the usb jargon is).  I would expect 
you want to open something that looks like 
\\.\blah-blah-usb-blah-blah on Windows or /dev/blah-blah-usb-blah 
on OS X.  I have heard that some usb devices have a view that looks 
like a serial port to make tinkering easier.

If you are interested in opening a serial port on a usb device, I can 
tell you more.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: [OT] DLL Handles

2003-07-14 Thread Dar Scott
On Monday, July 14, 2003, at 05:48 PM, Scott Rossi wrote:

I've got an installer script that calls a DLL repeatedly within a 
repeat
loop to grab current system information (processes). What is the proper
point to call closeHandle: within the script's repeat loop, at the 
end, and
then get a new handle from the DLL at the beginning of the loop, or 
should I
call closeHandle outside the repeat loop once the script has finished
running?
You shouldn't have to worry about any DLL housekeeping with an 
external.  I expect this is DLL specific and refers to a user object or 
query object and not the DLL itself.

I'd guess you'd want to close it once at the end.

It probably makes the query once and then gives you pieces based on the 
handle and either the next position or an index.

My wild guess.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Style question: returning error values from functions

2003-07-13 Thread Dar Scott
On Sunday, July 13, 2003, at 12:13 AM, Monte Goulding wrote:

Is it possible to throw from an external? I haven't done any external
development yet although as soon as I see some decent docs I'll 
probably
jump in as I know some C.
I'd be inclined to include a glue stack library with an external.  It 
would handle the sugar coating for problems like passing data with 
nulls.  In many cases it would do most of the work and use the external 
for getting to OS services.

In this case, the glue library can throw for its own work and then 
throw for external errors flagged in globals.

Dar Scott
who didn't really answer your question
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Style question: returning error values from functions

2003-07-12 Thread Dar Scott
On Saturday, July 12, 2003, at 06:11 AM, Richard Gaskin wrote:

Which approach do you prefer?  One of these?  Something else?
I use these:

1.  Reshape the semantics so there are no errors.
2.  Throw
3.  Value returned in referenced variable and success/fail (or related) 
returned.
4.  Separate domain validation functions (used before instead of after) 
with, perhaps, #2 or #10
5.  Callback (very rarely for functions; I'll ignore this)

Sometimes #1 is like your error prefix but not always.  For example, 
char 5 of abc returns a reasonable value, empty, rather than an 
error. In this approach what is reasonable depends on the function.  
Another #1 approach is to define a way to coerce parameters to the 
nearest closest value.  A general scheme can be used for numbers that 
uses rounding and bounding as needed.

The callback might reduce to changing a global error to a local error.

These are also acceptable to me:
6.  Global
7.  Function like sysError()
8.  Error returned in referenced variable in parameters
9.  Use NaN, +Inf, etc for numerical functions (like #1)
10.  Let the function throw error or return garbage; used with #4
Revolution built-in functions and operators use 1-3.  Of #1 some return 
reasonable values and some coerce parameters to the function domain.

I readily use throw in scripts for my own use.  I also have used it in 
a library I will make generally available, and I'm thinking of changing 
the scripts so that they do not throw.  Are people comfortable with 
throw?

The value of functions is that you can use them in expressions.  If you 
have to check after each use, then you lose the benefit.  That makes #2 
(throw) with perhaps #4 (data checking beforehand) more interesting.

Dar Scott







___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds

2003-07-11 Thread Dar Scott
On Friday, July 11, 2003, at 01:04 AM, Nelson Zink wrote:

Computational
results are predictable, completion time wobbles. The finer time is 
cut, the
greater the unpredictability.
The problem I see is that the ruler you use to measure the time is not 
independent.  You are using a timer based on the same clock.

However, because there is a lot going on in OS that can add randomness, 
such as communications interrupts, fan control interrupts or whatever, 
there will be some.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Anomalies

2003-07-11 Thread Dar Scott
On Friday, July 11, 2003, at 08:09 AM, Shari wrote:

Shari wrote:

 I wonder if I should bombard Kevin with the anomalies I've had to
 find workarounds for... such as random(0) = 1
Under what circumstances would random(0) be expected to provide a 
useful
result?  Why not save the clock cycles by using 0 directly?
From my original post when discovering this anomaly:

Why would one want to get random(0), you ask?

If 0 is a variable, which could be any number, and you write a 
mathematical function, assuming that if the variable is 0, the end 
result of the function will also be zero, the function fails.
You are quite right about using 0 directly.  You might have a variable 
or other expression that needs to work in general.  And you are right 
that functions should be generalized as they naturally might.

However, I disagree that this is an anomaly.

The random(x) function is defined to return an integer in the range 
from 1 up to round(x).  We can think of the rounding as incidental and 
think of only whole numbers.  In that case it takes whole numbers 1 and 
up.  That excludes 0 from the domain of the function.  The function is 
not defined for 0.  The function is not an anomaly, because 1 up to 0 
is not meaningful.  I think the function should not crash for numbers 
outside the domain, but I hold it to nothing else.  Well, I would be 
upset if it returned a very long string.

You can define your own function, say, rnd(), based on random() and use 
that in your scripts.  It will take less time than sending a note to 
Kevin.  You can use that everywhere.  It would be at most seven lines 
long.  If you decide you want random(x+1)-1 instead of the version with 
the _if_, then you can change it in only one place.  (And then the 
function is only three lines long.)

Many built-in functions do force parameters to the closest valid value. 
 If that was done, you still would not get zero.

I, too, am not happy with some built-in functions.  For example, I wish 
mod worked differently, but I can make my own.

I would find useful a completely different random(), perhaps with 
another name, such as rand().  One that takes a number between 0 and 1 
inclusive and returns true or false.  In this case, applying it to 0 
would always return false.  Perhaps this is the kind of thing you are 
looking for.  That can be built.  It only has to be built once whether 
scripted or built-in.

It is my opinion that this is one of those cases in which you bend to 
the product and not the other way around.

Dar Scott



___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Anomalies

2003-07-11 Thread Dar Scott
I got to thinking Shari that you might be wanting a different function, 
anyway.

Consider this:
random(5) returns one of 1, 2, 3, 4, 5
random(4) returns one of 1, 2, 3, 4
random(3) returns one of 1, 2, 3
random(2) returns one of 1, 2
random(1) returns one of 1
And adding the one you want,

random(0) returns one of 0

That looks like an anomaly to me.

Maybe, you want this:

random0up(5) returns one of 0, 1, 2, 3, 4, 5
random0up(4) returns one of 0, 1, 2, 3, 4
random0up(3) returns one of 0, 1, 2, 3
random0up(2) returns one of 0, 1, 2
random0up(1) returns one of 0, 1
random0up(0) returns one of 0
In that case, 0 fits right in.

You can use this function, if this is the behavior you want:

function random0up n
  return random(n+1)-1
end random0up
I hope this helps.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds?

2003-07-11 Thread Dar Scott
On Friday, July 11, 2003, at 12:54 PM, Ray G. Miller wrote:

Adding three more zeros yielded:
1057948840.14027500152587890625000
1057948841.41388595104217529296880
1057948842.74860799312591552734380
1057948848.56447696685791015625000
1057948852.67774403095245361328120
1057948979.99965500831604003906250
1057948984.09295594692230224609380
1057948985.36483705043792724609380
1057948998.36404299736022949218750
1057948999.02833700180053710937500
   ^
And right about here (depending on how quoting is handled in your mail 
client and whether you use a fixed-pitch font) is a column that 
consists of only 0's and 9's.  I think that means the real resolution 
is 1 microsecond.  The rest is all binary-to-decimal.  The binary 
floating point can only represent values to about 1/9 of a microsecond. 
 The extra digits are the results of the number not being able to get 
closer than 1/9 microsecond.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds?

2003-07-10 Thread Dar Scott
On Thursday, July 10, 2003, at 09:57 AM, Ken Ray wrote:

Dar, I think the long seconds
returns milliseconds as well, but in a slightly different format: I
opened the message box and typed:
  put the milliseconds  the long seconds

and got this:

  1057852538054 1057852538.054

Identical, except for where the decimal point was placed...
1057853216369 1057853216.369436

OS X 10.2.6 on MDD G4 dual 1.25 GHz.  Nyah-nyah! Nyah! Nyah!

Test seem to indicate that I really get microseconds, yes, right down 
to the microsecond.

(Some clever person can find out when we did the tests.)

What wimpy OS are you using?  ;-)

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds?

2003-07-10 Thread Dar Scott
On Thursday, July 10, 2003, at 11:38 AM, Ken Ray wrote:

What wimpy OS are you using?  ;-)
You're right! It's OS-dependent. The wimpy OS was Windows XP; I
checked it on my Mac (same config as yours) and I get the extra
microseconds. Cool!
It might not be XP's fault.  I have used NT and Win2K system calls that 
had nanosecond resolution.  This does not mean the OS or the hardware 
can handle that, but it does hint at greater time resolution (smaller 
than ms).

The same engine is used for all supported Windows platforms, whether 
95/98/NT/2000/Me/XP, whether home, pro or server.  I imagine parts of 
the engine might use the reduced common capability and parts might make 
runtime decisions based on the OS.  Perhaps the long seconds is in the 
first part.

I, personally, wouldn't mind if the Windows engine split into two if 
the 2K and XP Pro got some improvement or features.

BTW, the microseconds in OS X (and, it seems from Ray's comments, Mac 
OS 9.2) are handy for timing operations when using a repeat loop is 
awkward or otherwise inappropriate.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Cross-platform fonts

2003-07-10 Thread Dar Scott
On Thursday, July 10, 2003, at 10:57 AM, Richard Gaskin wrote:

I know some slipped thru the cracks, as initially I chose Helvetica
as the default, only to discover it was not very consistent on the
platforms, so I switched to Arial for most text, and occasionally
Verdana.  They seem to be pretty consistent from platform to
platform.
This raises a question:

Now that Micro$oft has abandoned EI for the Mac, what will become of 
the
useful set of cross-platform fonts that used to be pre-installed on 
both
Mac and Win?
I expect to use the multi-platform Revolution fonts that come with 
Revolution 3.0.  ;-)

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds?

2003-07-10 Thread Dar Scott
On Thursday, July 10, 2003, at 04:04 PM, Scott Rossi wrote:

What do you folks get?
A headache, from looking at all those digits
OK, this has less digits.

on mouseUp
  set the cursor to watch
  put Upper bounds on time resolution (maybe 10 to 20 microseconds 
high):  LF into field Report
  --
  put the seconds into time1
  put the seconds into time2
  repeat while time1 is time2
put the seconds into time2
  end repeat
  put the seconds resolution:   (time2-time1)  LF after field 
Report
  --
  put the long seconds into time1
  put the long seconds into time2
  repeat while time1 is time2
put the long seconds into time2
  end repeat
  put the long seconds resolution:   (time2-time1)  LF after field 
Report
  --
  put the ticks into time1
  put the ticks into time2
  repeat while time1 is time2
put the ticks into time2
  end repeat
  put the ticks resolution:   (time2-time1)  LF after field Report
  --
  put the long ticks into time1
  put the long ticks into time2
  repeat while time1 is time2
put the long ticks into time2
  end repeat
  put the long ticks resolution:   (time2-time1)  LF after field 
Report
  --
  put the milliseconds into time1
  put the milliseconds into time2
  repeat while time1 is time2
put the milliseconds into time2
  end repeat
  put the milliseconds resolution:   (time2-time1)  LF after field 
Report
  --
  put the long milliseconds into time1
  put the long milliseconds into time2
  repeat while time1 is time2
put the long milliseconds into time2
  end repeat
  put the long milliseconds resolution:   (time2-time1)  LF after 
field Report
  --
end mouseUp

My OS X result:

Upper bounds on time resolution (maybe 10 to 20 microseconds high):
the seconds resolution: 1
the long seconds resolution: 0.15
the ticks resolution: 1
the long ticks resolution: 0.000847
the milliseconds resolution: 1
the long milliseconds resolution: 0.010986
I would guess the XP result will show ms resolution.

Note that the long milliseconds seems to be faster than the long 
seconds.

You guys pick up the ball; I'm out the door.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds?

2003-07-10 Thread Dar Scott
On Thursday, July 10, 2003, at 04:24 PM, Dar Scott wrote:

A headache, from looking at all those digits
OK, this has less digits.
But this is better.  The first call to long seconds or long 
milliseconds is thrown away on this one.  It takes longer for some 
reason.

on mouseUp
  set the cursor to watch
  put Upper bounds on time resolution:  LF into field Report
  --
  put the seconds into time1
  put the seconds into time2
  repeat while time1 is time2
put the seconds into time2
  end repeat
  put the seconds resolution:   (time2-time1)  LF after field 
Report
  --
  put the long seconds into junk
  put the long seconds into time1
  put the long seconds into time2
  repeat while time1 is time2
put the long seconds into time2
  end repeat
  put the long seconds resolution:   (time2-time1)  LF after field 
Report
  --
  put the ticks into time1
  put the ticks into time2
  repeat while time1 is time2
put the ticks into time2
  end repeat
  put the ticks resolution:   (time2-time1)  LF after field Report
  --
  put the long ticks into time1
  put the long ticks into time2
  repeat while time1 is time2
put the long ticks into time2
  end repeat
  put the long ticks resolution:   (time2-time1)  LF after field 
Report
  --
  put the milliseconds into time1
  put the milliseconds into time2
  repeat while time1 is time2
put the milliseconds into time2
  end repeat
  put the milliseconds resolution:   (time2-time1)  LF after field 
Report
  --
  put the long milliseconds into junk
  put the long milliseconds into time1
  put the long milliseconds into time2
  repeat while time1 is time2
put the long milliseconds into time2
  end repeat
  put the long milliseconds resolution:   (time2-time1)  LF after 
field Report
  --
end mouseUp

Now, I'm really really gone for the evening.

Dar

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds?

2003-07-10 Thread Dar Scott
On Thursday, July 10, 2003, at 09:12 PM, Nelson Zink wrote:

But do you have any reason to believe the processor clock and the long
seconds clock are not the same?
Generally no, but strictly? I suppose I do. My long seconds are being
displayed to 20 magnitudes of precision (with proper numberFormat
adjustment). Either an alien technology has taken up residence in my 
machine
or something's screwy. I'm betting on the later.
The results of many operations and functions are internally double 
precision floating point numbers.  They are converted to strings when 
they need to be.  We can do much of our scripting without knowing or 
caring.  The floating point representation is binary.  There are 52 
bits in the precision plus an invisible bit for the left most one (for 
non-zero values).

The current date-time in seconds is about 1,058,000,000.  (1Gs = 32 
years, 1 year = 31 Ms, 1Ms = 11 1/2 days, 1ks = 17 minutes, approx.)  
The floating point number can represent about 16 digits.  That means 
you can't do better than about 100 ns (with the current number scheme).

I think we are seeing 1 microsecond resolution on OS X and 1 ms 
resolution on XP.  All those extra digits are from the binary to 
decimal conversion and are not meaningful, that is, not meaningful in 
time, but are predictable meaning they are worthless to as random bits. 
 (I think 1 microsecond 'long seconds' resolution is a reasonable goal 
for all platforms for the time being.)

You can collect some random bits using the long seconds, I think, but I 
don't think you want to base it on how long it takes to execute some 
code.  You might want to harvest it from operator interactions and if 
you don't have enough of those, from Internet response times.  The 
number of bits you can harvest depends on your estimate of 
predictability.

If we are really seeing only 1 ms on XP, then you have less bits to 
harvest and it will take you longer to get enough for a seed; save 'em 
up.

Dar Scott

**
  Dar Scott Consulting Programming Services [EMAIL PROTECTED]
**
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Smaller than milliseconds?

2003-07-09 Thread Dar Scott
On Wednesday, July 9, 2003, at 08:30 PM, Nelson Zink wrote:

Is there any way to access a time period/measurement smaller than
milliseconds in either MetaCard or Rev?
the long seconds

I get microsecond resolution on OS X on my blue  white and on my MDD 
Macs.  It may be different on other OS's.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Files function and Convert command

2003-07-03 Thread Dar Scott
On Thursday, July 3, 2003, at 10:35 AM, Gregory Lypny wrote:

For example, Mac OS X shows a creation date of Fri 3
Jan 2003 at 12:38 a.m., but converting the creation date from the
detailed files result in MC gives Thu 2 Jan 2003 at 7:38 p.m.
From the headers of your mail:

X-Original-Date: Thu, 03 Jul 2003 12:35:32 -0400
Maybe that accounts for 4 out of those 5 hours.  I'm just babbling out 
of turn.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: How do you join lines in a container

2003-06-12 Thread Dar Scott
On Thursday, June 12, 2003, at 11:19 AM, Sadhunathan Nadesan wrote:

| This little test worked as I expected:
|
| on mouseUp
|put field Input into theArray
|split theArray by LF and |
|put keys(theArray) into theKeys
|put theKeys  LF into field Report
|combine theArray by LF and |
|put theArray after field Report
|   -- From Sadhu's code...
|repeat for each line x in theKeys
|  put x   :---:   theArray[x]  cr
|end repeat
| end mouseUp

Ok, you are using LF and that is working for you, but not for
me.  Hmm...  what platform are you on?
I'm really a Revolution user listening in on the big boys who use MC in 
a attempt to learn.  I found this interesting and jumped in.  I'm using 
Revolution 2.0.1 on OS X.  That should be the engine for MC 2.5.

If you have numToChar(0) in your data it will not display right in a 
field.  Well, it wouldn't a half year ago, so I suspect not now.  You 
might want to check for that.

You might want to look exactly at how the data to be combined looks.

Are you sure about no | and numToChar(10) in the data?

Dar Scott



___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Passing an array to a function/handler

2003-06-11 Thread Dar Scott
On Wednesday, June 11, 2003, at 05:27 PM, Huisingh, Larry R wrote:

I can't tell from the docs...Can you pass an array to a function (or 
handler)? 
Yes, but arrays do not have full value semantics.

You can pass an array as a parameter.

You can return an array as the value of a function, but that cannot 
be directly a parameter to another function or handler and it cannot be 
[ ]'d.  You cannot create array expressions.

This means you can use an array to represent interesting data, but the 
fact that it is an array cannot be hidden.  (Because of that, you can 
feel free to use reference variables as parameters, should you work 
with very large arrays, even when you don't modify the variable--you 
can't have an array expression as a parameter, anyway.)

Try this:

function fetch e, k
  return e[k]
end fetch
function makeA
  local x
  put abc into x[a]
  put a into x[b]
  return x
end makeA
on mouseUp
  local y
  put eee into y[v]
  put fetch(y,v)  LF into field Report
  put fetch(makeA(),a)  LF after field Report
  put makeA() into y
  put fetch(y,b)  LF after field Report
end mouseUp
This produces this:
eee
a

It does not produce this:
eee
abc
a
Also, arrays will be empty whenever a string conversion occurs.  This 
includes send.

Dar Scott
Revolution Lurker who needs arrays.  Or, at least, a bonus.
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: broadcast?

2003-06-07 Thread Dar Scott
On Saturday, June 7, 2003, at 04:30 PM, RCS wrote:

Has anyone been able to do a broadcast message using TCP sockets or 
UDP? How
did you do it?
No broadcast for TCP.  Use UDP.

Use 255.255.255.255 as your ip destination address in open.

Or, better yet, use the subnet broadcast address.  For example if your 
subnet is 10.50.0.0 with mask 255.255.0.0 then use 10.50.255.255 as 
your broadcast address.

I have seen my OS X translate 255.255.255.255 to a subnet broadcast on 
my primary adaptor.  My XP (or was it W2K?) did not.  Perhaps there 
will be a difference in behavior only if there is more than one subnet 
on the LAN.  I'm not sure what happens when you have more than one 
adaptor and you use 255.255.255.255 as the address.

Accept as usual (remember to close UDP these days).  Send as usual.  I 
don't know if the new ability to reply to UDP will work with 
broadcast--that would be cool.

Dar Scott
Mostly-Lurking Revolution User
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Message box field deleted

2003-01-12 Thread Dar Scott

On Sunday, January 12, 2003, at 12:37 PM, J. Landman Gay wrote:


Has anyone else had this problem? Every once in a while, the field in 
the message box is deleted.

I've never seen this in any version of MetaCard. The only thing I can 
think of is that somehow the message box has become toplevel, and you 
have a script somewhere that deletes a field (or else you manually 
delete a field) and since the message box is toplevel, the deletion 
happens there instead of in the stack that was intended.

defaultStack?

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: [OT] invisible files on Windows

2003-01-10 Thread Dar Scott

On Friday, January 10, 2003, at 12:16 PM, Richard Gaskin wrote:


Any other tips for preventing the copying of QT media from a CD?


Store them as properties in an installer-like app that puts them on the 
user's system as needed?

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Creating thumbnail

2003-01-09 Thread Dar Scott

On Wednesday, January 8, 2003, at 11:12 PM, Karl Becker wrote:


Oh yes, it changes a lot.  It's for a golf game, actually.  The group 
I'm taking a snapshot of is the course itself, made up of graphic 
objects.It changes every time a new hole is loaded.

There may be ways to turn a problem into a solution.

1.
Maybe you can fly over a hole each time it is loaded taking snapshots 
as you go to create the thumbnail.

2.
The reduced snapshot may be hard to read anyway.  Maybe as one edits a 
hole, placing objects here and there, similar objects are placed on the 
thumbnail.  These are not tiny versions of the big objects but can be 
of any convenient type.  Also, they are designed to read better at the 
small size.  The green circle might scale exactly but have greater 
color contrast.  The flag might be large for the scale for readability. 
 They might also have a different perspective than the hole map.

3.
Only show the local area in the thumbnail, the rest is a surprise.

4.
Other?

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Subject: Short reads in CGI applications: THE SCOTT'S CHAMPAGNE WAY !

2002-12-20 Thread Dar Scott

On Friday, December 20, 2002, at 06:30 AM, Pierre Sahores wrote:


We'll look into supporting a simpler way to do this for 2.5 (not sure
whether to fix it so read .. for $CONTENT_LENGTH works, or to
support read .. until eof on pipes), but in the mean time something
like the above should solve the problem.
  Regards,
Scott


I like the idea (from my own non-CGI perspective) of both read .. until 
empty, meaning give me what you have, and read ... until eof, meaning 
read until the pipe is closed by the other end.  Might as well apply 
that to all reads where the difference is meaningful.

Dar Scott
(The voice in the back of the room.)

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: associative arrays

2002-12-13 Thread Dar Scott

On Friday, December 13, 2002, at 02:47 AM, Robert Brenstein wrote:


However, I need to pass it as an argument to a function that is 
dynamically defined and executed through do.

put webArg into fName -- let's say webArg = somfunction

do get  fName  (  myArray  )

function somfunction myArray
return myArray[key]
end somfunction

In somfunction, the associative array give empty values for key and 
array elements.

I have seen other limitations.  I can return an array from a function 
and pass an array as a parameter but not both in the same expression as 
in somFunction(buildArray()).

I have been successful in this:
do someHandler a b c
where c is a handler local variable containing an array.

You may want to experiment with value().

I hope you mention how you solve this.

Dar Scott
(a Revolution user sitting in the back row)

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: associative arrays

2002-12-13 Thread Dar Scott

On Friday, December 13, 2002, at 04:34 PM, Scott Raney wrote:


This is because you can only pass arrays using *variables*, not as the
return value of a function call.  In C/C++/Java, trying to do the
above where someFunction takes a reference would generate a syntax
error.  MC/RR, being an untyped language, just silently takes the
scalar value (which in this case will be empty) if it can't find a
variable when it gets to the called function.


Yeah, arrays seem to have something to do with variables in most 
programming languages.  Some languages, though, allow arrays to be full 
values and not special kinds of variables.  Examples are LabView, some 
dialects of lisp and almost C++ (vectors).  I was wishing for and 
encouraging that kind of thing.

I don't think MC/RR is far from that.  It seems to be almost there.  
Maybe it can work like this:  The scalar value can be taken only when 
a string is absolutely required.  I'm thinking of expressions like 'x  
empty' or commands like 'put x into field A'.  When conversion is not 
required, then the array--as value--is passed around.  This means 
especially as parameters and as returned values.  Just as an internal 
number can get about and converted to a string as needed, so should an 
array.  This allows folks like me to use a functional programming style 
without it getting in the way of those who prefer to think of arrays as 
something to do with variables.

Dar Scott
(causing confusion in the back row)


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Answer File Command

2002-12-05 Thread Dar Scott

On Thursday, December 5, 2002, at 06:50 PM, Monte Goulding wrote:


This doesn't work for me on OS X. I think what we need is a combined 
filter
like:
TEXT|*.txt. This way we don't need to test the platform and it would 
work
properly on OS X also.

YES!

(Whoops.  I'm having trouble keeping my activity to lurking.)

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: launching on Wintel/inter-process communication

2002-12-03 Thread Dar Scott

On Tuesday, December 3, 2002, at 09:52 AM, Richard Gaskin wrote:


I appreciate the feedback, but I wound up polling a file for now.


I think this in general is an under-appreciated and under-explored 
approach.  I have seen this used as IPC in a mixed Windows  Linux 
environment using SAMBA.  You might want to see if directory polling is 
faster.  And watch out for the file being in use.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: launching on Wintel/inter-process communication

2002-12-03 Thread Dar Scott

On Tuesday, December 3, 2002, at 11:27 AM, Richard Gaskin wrote:


By directory polling, do you mean checking the existence of a file 
rather
than its contents?  That's the approach I took, much faster than always
accessing the file.

Cool!  I would guess that would avoid locking problems, too.  (Let's 
see; scribble under Gaskin in the rollodex, file-based IPC expert.)

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Time display

2002-11-26 Thread Dar Scott

On Tuesday, November 26, 2002, at 10:12 AM, Ken Ray wrote:


Actually that should be:

   Idle handlers are the devil's workshop.


Or maybe:

The road to hell is paved with good indention.


  An idle soul suffers hunger.  -- Proverbs 19:15b

Solomon meant by this, do doubt, that stacks that use idle heavily tend 
to consume CPU cycles and get sluggish.

BTW, if a more timely refresh is needed in a clock or other GUI display, 
the more repetitive send-cycle handler can check whether the data has 
changed and only update the control only if it has.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: md5digest

2002-11-22 Thread Dar Scott

On Friday, November 22, 2002, at 12:56 PM, Richard Gaskin wrote:


Given this, I'm at a loss to think of practical uses of it in MC until
encryption becomes available.


User password
Product key
Message checksum (for noisy channels)
File tamper check
Digital pennies

... and all those cases where authentication is needed but encryption is 
not:

Send display message to a public billboard
Launch doomsday device
Get (and delete) messages already exposed to the Internet

Dar Scott


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Testing on multiple platforms

2002-11-12 Thread Dar Scott

On Monday, November 11, 2002, at 08:15 PM, Richard Gaskin wrote:


I don't know what gave me the idea that Mac did away with that.  Hmm.
I had my original computer set up that way, with OS 7.0 and OS 6.0 or
some such thing.  Interesting...


That's how all of us have been doing dual boot with OS X.


I've been reading the online data on Apple Remote Desktop ($265 at 
provantage.com).  It runs on OS X and can manage Mac OS 8.1 up and OS 
X.  Maybe there is a way to hide some old Macs in the corner and use 
this for development testing.  I don't know whether Macs will boot 
without monitor and keyboard and mouse.  I haven't heard of this used 
for development.  Maybe...

Dar Scott


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Testing on multiple platforms

2002-11-11 Thread Dar Scott

On Monday, November 11, 2002, at 08:56 AM, Yates, Glen wrote:


A Window's developer would need at least 4 to test on the various
flavours of Windows.  Minimum.


Or one copy of Connectix's Virtual PC. :-)


And a fast PC or a very fast Mac.  I use this both on PC and on Mac, but 
since my Mac is not very fast (yet), I mostly use this on a PC, that 
is, an Intel box for Windows.

(I also considered VMware because of the serial and network modeling 
capability, but when installed on my XP it interfered with the ability 
of my OS X 10.1.5 to understand SMB from the XP, so I stayed with VPC.)

One might also consider an appropriate level of an MSDN subscription for 
the OS's if the license is right.

Dar Scott



___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Tips for code porting to MC

2002-10-29 Thread Dar Scott

On Tuesday, October 29, 2002, at 08:18 AM, [EMAIL PROTECTED] 
wrote:

Im looking for tips regarding porting variable redirection (pointers and
pointers to pointers)
and c-style struct variables.


I wouldn't ignore arrays, but I have been considering substructure in 
strings.  MC stings are byte strings and it might be that same-size char 
chunk replacements are efficient.  If so, you can create a data space 
within a string in a global variable.  I'd run the experiment, anyway.

Or you might try a mix in which some data are packed in strings and 
others are not, in which some pointers are implemented as arrays and 
some are implemented as string offsets.  This might be better if strings 
are always rebuilt.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: socketTimeoutInterval is NOT for connecting

2002-10-28 Thread Dar Scott

On Monday, October 28, 2002, at 06:19 PM, RCS wrote:


  I use 'socketTimeoutInterval' quite often...but that is for reading 
and
writing to a socket that is already open. I am looking for a timeout 
setting
for 'connecting' to a socket. If I use 'open socket' to connect to a 
device
that is either offline (or invalid), I would like to set a time out of 
5 or
10 seconds (the device usually responds in 1) instead of the default 1
minute. I can only get so many cups of coffee in a day you know...

If the target computer refuses the tcp connection attempt some Windows 
systems will force a delay of 9 seconds.  If the target computer does 
not respond some Windows systems will wait for 21 seconds.  On OS X, I 
have seen delays around 75 seconds if there is no target computer.  I'm 
not sure, but I think if the connection is rejected it responds 
immediately.

(I have seen some problems in the callback never showing up in 
connections to the same computer or in connections by a very slow 
computer with Windows 2000 or XP.  This has been fixed in MC 2.5A7.)

On Windows, you will (now) get either the callback or a socketError().  
On OS X you will get either a callback or something else.  The something 
else has been socketClosed(), but that may have changed to socketError().

The solution I would try (actually, I will try, so I'm interested in 
what others make work) would be to use a send in time at the same time 
as the open.  If any of the callbacks come in first, they cancel it.  If 
it comes in first, it cleans things up.  I assume a close socket will 
clean things up.

An alternate strategy is to make very little dependent on the wait.  In 
addition, perhaps a cancel button (if appropriate) can do the work of 
the send-in-time instead of the send-in-time.

Dar Scott
(A Rev user sneaking in and sitting in on the back row and speaking up 
more than he should)


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Network Blues

2002-10-16 Thread Dar Scott

On Wednesday, October 16, 2002, at 02:42 AM, Thomas McCarthy wrote:


BUT when I tried to use it at my school's computer room (Win98 boxes)
Students log on--OK teacher's computer recieves the message
Teacher sends data to student--NO GOOD!

The datagram message is on gotnews tWhom tWhat
I use tWhom  a predetermined port to get the student's address and send 
the data to that address

I assume gotnews is the accept callback.

What version are you using (home and school)?  There have been some recent 
changes in UDP on MC.  What you need to do to pull out the IP address from 
tWhom has changed, but there is a general method that will work with both.
  Also, these changes allow the creation of client/server apps so the 
response does not have to go back to a predetermined port; it can go back 
to the sender port.  Your method allows the teacher's computer to push data 
if need be, though.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: MC concurrency performance?

2002-09-10 Thread Dar Scott


On Tuesday, September 10, 2002, at 01:01 AM, Alex Shaw wrote:

 But what happens to other connections which try to access a server 
 app port while it's processing a request?
 Does accept on port with message buffer those or do they get 
 dropped and the client must open socket every few millisecs?
...
 These are UDPs in particular I'm talking about now, is this a 
 system thing or should I be worried that the client will run out 
 of ports? :)

Use the accept command.  This will generate a callback for each new 
UDP connection.  The callback will have the contents of the 
datagram that initiated things and a socket identifier for a new 
UDP connection.  This is separate from the socket id for the 
listening connection, that is, the one for the accept.

If you have only a simple service and need only send back a single 
response, you might do that in the callback.  Be sure to close the 
connection.

If there is a dialog, optionally send back a response and then pass 
the work on with either a send in time or a udp read with a 
callback.  The idle time clears things for receiving the next 
connection.  One simple approach that might work would be to have 
all the dialog work done in the read callbacks.  You can have 
either a single callback handler that checks the state of the 
discussion or several handlers with the handler selected by the 
callback specified in a particular read.  (The limitation is that 
this does not do anticipatory work or delayed response work; if you 
have a complex dialog, you might want to also do send in time to 
get work done while waiting for a response.)

The only connection info you have in the read callback is the 
socket ID.  You will have to manage all other connection state 
info through that.

If you want to limit the number of connections keep track of a 
count.  Increase it with the accept callback and decrease it near 
the close of the connection created with the accept callback.  If 
the count gets above some level, the accept callback should simply 
close the connection and exit immediately.  (If you worry about 
attack, also turn off the accept for a while.)

I put connection in quotes because there is no real connection 
in UDP at the tcp/ip protocol level, it is a convenience.

As with TCP, within UDP, connections are identical if the all 
four of local address, local port, remote address, and remote port 
are the same.  Datagrams are routed to the either the accept 
connection if new or to an established connection if that 
exists.  Ports will be assigned to the connections and there are 
lots available in a typical system.

You will eventually need to handle timeout conditions if there is a 
dialog.  Handle that the same way as other state transitions.

Dar Scott




___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: MC concurrency performance?

2002-09-09 Thread Dar Scott


On Sunday, September 8, 2002, at 02:58 AM, Alex Shaw wrote:

 I've just started playing with MC for doing a tcp server app. Few 
 questions..
 1. How well does MC handle multiple connections at once 
 ('concurrency')?

The concurrency problems related to performance will not be in tcp 
but rather in other I/O.  With the tcp/ip callbacks you can make 
relatively efficient scripts.  The main thing to do is make sure no 
handler is sitting around waiting for something, and especially not 
for very long.  (As you have probably realized, this normally means 
you can't do all the work in the accept callback and maybe should 
consider doing none.)

As the especially not for very long phrase hints, you might want 
to design your application to minimize time to respond in a dialog 
even if it increases total compute and I/O time for a dialog.

If your service involves a dialog that must have state then 
whatever method you use to make per-connection state (say, 
changing  many of those variables to arrays) may take a little 
longer, but I think that this normally will be small compared to 
I/O concerns.

You will also have to address connection limits and perhaps flood 
attack problems.  I think you should forget about efficiency under 
these conditions; the main thing is to keep your app in a 
reasonable state.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Fw: application slowing down

2002-08-20 Thread Dar Scott


On Tuesday, August 20, 2002, at 11:19 AM, Rich Mooney wrote:

 I'm desperate and throwing myself on the mercy of this mail list.  
 I have an
 irate customer who wants this problem solved quickly.  I have used
 MetaCard
 to create software which we use to monitor and control our distributed
 lighting control systems.  It does these things very well.  I 
 currently
 have
 a job which requires that I poll the status of all my controls 
 every 30
 seconds.  I do this so I can catch any changes of state and a close
 approximation of the time at which that change occurred.  I also 
 use this
 function to catch any errors in operation.  The problem is that 
 the time
 it
 takes to poll all the controls becomes increasingly longer the 
 longer I
 run
 the software.  Initially it will take 33 seconds to poll all of my
 controls
 if the polling interval is set to 30 seconds.  After three hours 
 it will
 take 43 seconds.  By the next day it will take 2 minutes.

Is your network TCP/IP?  Besides the processor usage you can 
monitor network usage and this may give a clue.  A packet sniffer 
might also.

Is each poll run by a batch of send in time?  If it takes 33 
seconds and a poll is started every 30 seconds, does that mean 
there is an overlap?  That can cause a few problems.

First of all each poll might take a tiny bit longer than the 
previous one if it competes for processor resources.  This is 
because the previous one overlaps.  This will cause that poll to 
overlap the next a little more, because it has been slowed down 
some.  Perhaps that is the growth you see.

Second, unless you carry all of your poll state in args of the 
handler spec'd in send (or other wise provide for this problem), 
you might have one send cycle messing up data from the next.

Third, if the dialog is command-response, there might be a risk of 
getting a response that is from a query of another send cycle.  
Handling those might cause more delays and use up a tiny bit more 
processor resource.

If this looks like it could be your problem, you might want to 
prevent a send cycle from starting if one is in progress or start 
them every, say, 45 seconds.  For now.

Then look for ways to get polling down under 30 seconds.  For 
example, you might query several controls at once.  You might want 
to trim the fat from your code.  You might enhance some hardware.

In the long term, you might want to put polling on leaf nodes only 
and distribute these over the system.  They can communicate with 
concentrators and central control in better ways than polling.  
Polling has killed many large system designs.

I made a lot of wild guesses.  (For example, I assumed that polling 
is started every 30 seconds, not that there is a 30 second delay 
from the end of one to the start of the next.)  Since you have a 
customer on your back, I figured that is the way to go.  I hope I 
got close to the mark.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Fw: application slowing down

2002-08-20 Thread Dar Scott


On Tuesday, August 20, 2002, at 04:26 PM, Rich Mooney wrote:

 No. My commands are going out a serial port to a device we make which
 converts from serial to our protocol which is similar to 
 Appletalk.  I do
 have the capability to send my commands through TCP/IP to a module 
 which
 converts from TCP/IP to our protocol and I've considered trying 
 this onsite
 to try to work around the problem.

I know what you are going through.  I just got a call from a 
customer on a similar problem.  Their customer had just upgraded 
their Unison (lighting control) system and now we have errors that 
slow down the polling cycle.  (I wasn't able to convince the Unison 
folks to avoid the need for polling back when they were setting up 
the protocol.)

I think I'm getting the picture.  The entire polling operation is 
done in one handler (and subs).  At the end of that the next one is 
scheduled with a send.

You might want to put a meter on the number of lines in 
pendingMessages() just to be sure this is how it is working.  Or 
log the value.

If this is all in one handler then you must be using read until 
string or read for n depending on your protocol.  Do you use 
in time?  You might want to log those timeouts or put a counter 
on them.

You might want to log the time and the long seconds since start of 
poll for each write and read as well as other events such as 
retries.  Log result and syserr, too.

(I use a different style.  I read all available bytes in a single 
read in a handler called in timer send cycle and process those for 
messages.  I might get some delays, but this allows me to do other 
things at the same time.  And it allows me to use the same method 
for processing tcp messages as serial.  With tcp a callback is 
available.)

As you can tell, I've run out of ideas on what might be causing the 
slowing down.  These are just some that might give you a heads up 
as to what is happening.

You said only a slight increase in memory usage, right?

Is this the kind of thing where you need to empty your read buffer 
just before sending out a command just incase there is something in 
there?

Dar Scott


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: mouse tracking blues

2002-07-09 Thread Dar Scott


On Tuesday, July 9, 2002, at 04:03 PM, jbv wrote:

 If anyone has a brilliant idea for a possible solution,

Just a wild idea.  Use a send cycle (or both a send cycle and mouse 
messages) to do the show.  Start it with mouseDown and terminate it 
with mouseUp.

Dar Scott
(A Rev guy lurking--mostly)

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: shell on OS X

2002-05-06 Thread Dar Scott


On Sunday, May 5, 2002, at 03:44 PM, Mark Talluto wrote:

 I'm with you... There are a MILLION different things I'd like to 
 do with
 MetaCard for OS X, but I can't do them because MC for OS X 
 doesn't allow
 shell commands.  I end up using mc (darwin), or AppleScript, and 
 I'd much
 rather use MetaCard (OS X version.)  There are a bunch of us who 
 could write
 some serious kick-ass apps if MC could do this.

 I heard that we are moving over to a Mach-O build for the OS X 
 version of MC on the next release.  So, we should be very close to 
 having Shell support on X soon.

I'm a Revolution newbie (mostly) lurking on the mc list while I'm 
learning to program scripts.  However, I did make a makeshift shell 
command when I first started learning.  Perhaps it is a starting 
point for something that can work until a real shell comes about.

function shellSH cmd
   -- Sorry, no quote marks in cmd in this version
   -- And shellCommand is ignored
   put do shell script  quote  cmd  quote into s
   do s as AppleScript
   put result() into r
   replace numToChar(13) with linefeed in r
   return r
end shellSH

This uses sh and not tcsh that the Terminal program uses.  I had to 
use absolute paths.

One experienced with AppleScript might use the Terminal program.

Use with caution.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: using repeat for each when you don't want to start with the first line

2002-04-29 Thread Dar Scott


On Monday, April 29, 2002, at 08:01 AM, shop wrote:

 I have a number of repeat loops in my software which I would love 
 to speed up using the repeat for each technique but I don't want 
 to start with the first line. 

Just wondering.  Does repeat for each allow a chunk expression?

Dar Scott


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: ? What are Metacard's UDP (datagram) Limits

2002-04-29 Thread Dar Scott


On Monday, April 29, 2002, at 09:12 PM, Sparticus Zarris, Cross 
Country Communications wrote:

 Turns out, I can send any amount of data, any kind of data, but no 
 more than EXACTLY 65,507 bytes.

There is a limit on a UDP datagram size.  I don't know the exact 
size, but it is about this size.  A datagram including its header 
data (8 bytes) is packaged in a general IP packet which also 
includes some header data.  The whole thing cannot be larger than 
about 64 K.

 If I sent 65,508 bytes, NO PART OF THE DATA IS SENT.  NO ERROR IS 
 REPORTED.

Yes, an error might be appropriate.  Did you look at result()?

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: ? What are Metacard's UDP (datagram) Limits

2002-04-29 Thread Dar Scott


On Monday, April 29, 2002, at 09:12 PM, Sparticus Zarris, Cross 
Country Communications wrote:

 Why can't I find this documented anywhere?

You can find this in your TCP/IP references or the RFCs.

I responded earlier, but that may be incomplete.  What you are 
seeing is the maximum number that can fit in the total size field 
of 16 bits less 20 bytes of the minimum IP header less 8 bytes for 
the UDP header.

However some environments potentially have security requirements 
that do not allow the minimum header.

The UDP datagrams you are sending are broken into many small 
packets.  If any part gets lost, the whole thing is lost.  This 
fragmenting (which applies to all IP packets) is based on the MTU 
of the media encountered along the way.

For LAN communications, I would limit datagram sizes to about 8K.

Some firewalls will not allow fragmented IP packets.  Maybe some 
routers.  In those environments you might want to limit your 
datagram size to about 1200 bytes.  I have never run across this 
problem, so I'm not sure what would be appropriate as far as size.

Some instruments and DOS applications also have size limitations.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: What are Metacard's UDP (datagram) Limits

2002-04-29 Thread Dar Scott


On Monday, April 29, 2002, at 10:37 PM, Scott Raney wrote:

 Is this this way because of some underlying API (like maybe a limit in
 BerkeleySockets, or some such API that Meta is using).

 The UDP proptocol specification only guarantees up to a maximum size
 of 576 bytes.  Try to send anything larger than that and it might work
 on some systems but not others.

I believe this is the IP Packet limit.  It is intended to allow a 
data size of 512 bytes under worse-case IP header conditions.  In 
that case, the limit for UDP data is 504 bytes.

My experience is primarily in controlled situations so I don't run 
across this, but I think for Internet applications, one might best 
follow Scott's advice.

Dar Scott


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Comparing big lists

2002-04-27 Thread Dar Scott


On Saturday, April 27, 2002, at 02:10 PM, Gregory Lypny wrote:

 It takes about 6 minutes on a
 modest (300 mHz) iBook running OS X, but I'm hoping for an improvement,

Maybe.  Maybe if you are able to keep the lists sorted you can come 
up with a faster way that takes advantage of that.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Call WinAPI?

2002-04-10 Thread Dar Scott


On Wednesday, April 10, 2002, at 07:24 PM, Ken Ray wrote:

 If they don't have a command line argument, you will need to have 
 some other
 app (such as a small VB app) do this for you (unless someone else 
 knows how
 to do this).

Try the shell command start.  I use it for console apps and it 
might work for GUIs.  I'm not sure what Windows has that, though.  
My W2K does.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: chat program behind a router

2002-04-07 Thread Dar Scott


On Sunday, April 7, 2002, at 12:21 AM, Mark Talluto wrote:

 By TCP, do you mean:

 accept connections on port 80 with message connectiong
 vs
 accept datagram connections on port 80 with message connecting

The first uses TCP.  The second uses UDP.

UDP would make a great chat method on a local network.  It can 
broadcast, too.  It can be done simply.  I think mc UDP will have 
trouble with a firewall, though.  You might be able to send packets 
from behind the firewall to outside the firewall, but will have 
trouble receiving them behind the firewall.

TCP creates a virtual wire between a port on one computer and a 
port on another computer.  A port is simply a 16-bit number.  Bytes 
can be sent down the wire both directions.  The connection is not 
symmetrical.  The connection is initiated by one end, popularly 
called the client.  The other end accepts the connection and is 
often called the server.  In the sockets model of TCP, the server 
can have lots of wires connected to the same port.  They are 
differentiated by the port and computer at the other end.  Other 
than that, ports are not shared.

One computer (client) uses open to initiate the connection.  The 
other (server) uses accept to accept one or, perhaps, more 
connections.  You provide the connection string with open and you 
are provided one with the message from accept.

You are most likely to succeed with the client using open behind 
the firewall and the other computer (outside the firewall) being 
the server using accept.

A typical low-security firewall will allow you to make a TCP 
connection from behind the firewall to outside the firewall, but 
not the other way.

A typical firewall will also use NAT (network address 
translation).  The most common NAT method (and a firewall might use 
several) makes all connections look--from the outside--as though 
they are from the firewall itself.  This means that the IP address 
of the client as seen from the server might not be that of the 
actual computer making the link.

Though using port 80 can solve some problems, it can also create 
problems.  Try a high port number, first.

In your initial tests, use the same computer for both ends.

Depending on your situation, you might want to take the person 
responsible for the firewall settings to lunch and explain what you 
are doing.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Protecting Things from prying eyes....

2002-04-07 Thread Dar Scott


On Saturday, April 6, 2002, at 10:20 PM, Michael Crawford wrote:

 Does any one have any suggestions about what I could do here? My 
 two lines
 of thought are:

 1) I could either encrypt the images using some other method than 
 base64 I
 am open to suggestions about how I could do this.

Any simple method I give you would hardly be better than the 
obfuscation that you already have.

If you must do more, the next step is serious encryption.

One approach is to have the stack run a command line PGP 
application.  Since NAI dropped the PGP line, your choices are 
limited if this is a commercial application.  I'd consider GnuPG.  
It is available on several platforms.  It is a little rough around 
the edges but should work for your narrow need.  (If you find a 
shrink wrapped legal copy of PGP 6.5.8 command line commercial and 
don't need it, contact me.)

Alternately, if you have control over all computers involved, turn 
on IPSec for the applicable connections.

 2) I could build a better password protected site with cgi's or 
 ASP or some
 such thing though then I have issues with server hosting etc.

Same problems.

 3) I am just being to paranoid about the whole thing. If anyone get's
 through all of the road blocks I have created perhaps I should 
 just give
 them a chocolate fish  and a certificate and not worry about it...

Simple obfuscation is appropriate in some cases and it may be in 
this case.  You have to look at the economic factors for the spy 
and use that to assess the probabilities in assessing your risk 
(prob and cost).  You also should look at other factors such as the 
cost of the stack getting bogus pictures.

If these are pictures of a new product and you don't want Ford, 
Microsoft or France to see them, then you may need strong 
encryption.  On the other hand, if you don't want people to see 
your maps of NZ that you worked so hard to make unless they pay for 
it, then encryption is less important.

My wild guess is that you can probably get by with even simpler 
obfuscation and then forget about it.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: chat program behind a router

2002-04-06 Thread Dar Scott


On Saturday, April 6, 2002, at 12:36 AM, Mark Talluto wrote:

 Thanks Dar.  I will probably have an option for the user to select 
 peer to peer or use the server option if needed.  The peer to peer 
 is neat simply because it does not require a server, but may be 
 the only option for internet users.  The use of firewalls is 
 becoming more and more prevalent.

Remember, in peer-to-peer the guy behind the firewall initiates the 
connection.  (And on mc it should be TCP.)


Even this might be blocked on some firewalls.  A couple ways to 
address this comes to mind.

First, you can used a standard chat protocol.  That makes it easier 
for the person behind the firewall to explain what is needed to the 
firewall guy.  Alternately, you describe exactly what is needed 
that can be printed and handed to the firewall person.

Second, you can look like an allowed protocol.  Many applications 
use HTTP.  If there is also a proxy, the dialog must look a lot 
like HTTP.

These don't seem to be the problem in your particular test case.

Dar


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: chat program behind a router

2002-04-05 Thread Dar Scott


On Friday, April 5, 2002, at 10:17 AM, Mark Talluto wrote:

 Is my problem with settings on the routing software or with my 
 chat program?  Any insight on this would be greatly appreciated.

My guess is that the router has some sort of firewall capability.  
This can cause problems in a couple ways.  It might not allow TCP 
connections (or UDP packets) from the outside (though most make 
exceptions for FTP).  Second, it might be set up for NAT, static or 
masquerade.  Even if you are set up for masquerade, there may be a 
server option that forwards certain connection attempts to the 
router to a particular computer.

If you can't change settings on the router, try creating a server 
stack that runs someplace outside the firewall.  Have all chat 
clients TCP to that.

If you need only point to point, have b TCP to a.

(It is sometimes easier to establish a dialog through a firewall 
with TCP than with UDP.  This is especially the case with with mc 
port assignment limitations; the firewall might only allow a packet 
with exactly the source  destination swapped from one that 
recently went out.)

Hope this helps.

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Delete Resource Fork

2002-04-04 Thread Dar Scott


On Thursday, April 4, 2002, at 12:11 PM, Scott Rossi wrote:

 Anyone know a way using MC to delete the resource fork of a MacOS file?

I'm looking at page 19 of my new Metacard User's Guide.  From that 
it looks like you can make it empty with this:

put empty into URL resfile:path

I have no idea whether this is the same as deleting the resource 
fork.  For that matter, I have no idea what the real effect is.

Dar Scott


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Convert T/F

2002-04-02 Thread Dar Scott

My entry:

function tf bool
   return charToNum(char 3 of bool) bitAnd 1
end tf

Dar Scott


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Convert T/F

2002-04-02 Thread Dar Scott


On Tuesday, April 2, 2002, at 08:08 PM, Ken Ray wrote:

 function ConvertTF what
 return abs(5-length(what))
 end ConvertTF

I like this!

But why abs()?

If this doesn't need abs(), I think you might have the winning 
entry, Ken!

function ConvertTF what
 return 5-length(what)
end ConvertTF

Dar Scott

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: launch theFile with theProgram

2002-03-28 Thread Dar Scott


On Thursday, March 28, 2002, at 07:20 AM, Shari wrote:

 To launch a text file with a text program (Simpletext on Mac, ? on 
 Windows)

On Windows?  You may not need to know where or what about the 
program.  On my Windows 2000, the shell (cmd.exe) allows a document 
with a known extension to be used as a command.  (This might be in 
the extended commands and not available on some Windows, I'm not 
sure.)  So, I'd try launch/shell(start...)/open process with 
simply the file name.

On Mac?  AppleScript?

Dar Scott



___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Launch with Parameters?

2002-03-25 Thread Dar Scott


On Monday, March 25, 2002, at 03:57 PM, Scott Rossi wrote:

 On Windows, how can one launch an application with parameters 
 included in the command line?  For example, with most installers, 
 including /s after the path to the installer will cause the 
 installer to run silently.  Can this be done from MC using open 
 process or similar?

Yes.  I have used command line args in shell and open process.  
For example:

... shell(ping -n 1 127.0.0.1) ...

Dar

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard