Page 13 of 27

Re: Combination Circuits/Schematics

PostPosted: Mon Aug 07, 2017 3:23 pm
by tiffy
RUBY PROBLEMS ENCOUNTERED WITH PUTS, PRINT...sometimes it provides an output, sometimes the wrong output and sometimes nothing at all. Here I have compiled some examples to highlight the issues.

Even if I convert it to "output", I still encounter the same issues as mentioned above...and I don't see anything wrong with the Ruby Code ?

Re: Combination Circuits/Schematics

PostPosted: Mon Aug 07, 2017 7:28 pm
by tulamide
Those are console commands. You don't use a console for external communication, but Flowstone (thankfully!). So don't use them.

Re: Combination Circuits/Schematics

PostPosted: Mon Aug 07, 2017 11:22 pm
by RJHollins
You guys are making me wonder .........

could we ever get FS to PRINT to a ............. printer ?

Re: Combination Circuits/Schematics

PostPosted: Tue Aug 08, 2017 8:17 am
by tiffy
tulamide wrote:Those are console commands. You don't use a console for external communication, but Flowstone (thankfully!). So don't use them.


Hi tulamide, thanks for your reply.

Just to make sure I am tuned to the same frequency as you: When you refer to the "console commands" of Ruby irb, do you thereby mean the "print & puts" commands?

If so, I normally don't use the Ruby irb console commands i.e. "puts & print" but I rather use the Flowstone command i.e. "output 0, ..." - but as I stated previously:

"Even if I convert the Ruby irb Console Commands (i.e. print & puts) to the Flowstone command i.e. "output 0,...", I still encounter the same issues with that Ruby Code as mentioned... "

Unless there is something else I am overlooking in some of the Ruby Code in the previously attached schematics.

P.S. Regarding a previous post of mine on page 10, and I quote:

"tiffy wrote:Unfortunately, in DSP Ruby many things differ from plain Ruby irb console which have to be converted first for it to function in DSP Ruby and there is not much yet on the internet on DSP Ruby. It would be useful if Flowstone Admin could write a short course on DSP Ruby also covering the things I mentioned above and even sell it as a separate ebook...it don't necessarily have to cover every aspect of DSP Ruby, just the most used basics. Maybe, I should put this as a request in the "wishlist" ? "

As I said before, "print & puts" as well as "require" (which you also mentioned) is but some of the things that falls into the category which need to be clarified at least in the DSP Flowstone User Guide. (Unfortunately I can not recall all those things from the 'thumb'). For a Ruby noob like myself, those 'simple' things are not as obvious as it seems to the Ruby Guru's.

@RJHollins "You guys are making me wonder .........

could we ever get FS to PRINT to a ............. printer ?"

Good question, I never even tried to "print" to a printer using Flowstone. But if it can be done, it would be nice to be able to print out Flowstone schematics for example. Currently I am using a screen capture software to make pictures of my schematics which I then transfer into MS Word which can then be printed.

Re: Combination Circuits/Schematics

PostPosted: Tue Aug 08, 2017 10:43 am
by tulamide
Thanks, tiffy, I understand your concerns. Regarding ongoing issues after omitting these commands, I would assume that using them sets Ruby in an unpredictable state. The only way to reset Ruby is to exit and restart Flowstone. Try to make your changes until none of the commands exist anymore, save to a new schematic and restart Flowstone. If issues still exist, please upload that schematic.

Yes, there are simplified interface commands that have its roots in the unix/linux world. They refer to a so called standard input/output, which are defined globally as $stdin, $stdout and $stderr. They have no meaning while Ruby is embedded in Flowstone. For example, instead of $stdin all user input goes to Flowstone and Flowstone then hands over the input, that it wants Ruby to be aware of (like mouse clicks, but no direct key typing, for example)

Those commands belong to Ruby's kernel, which is another factor. Kernel commands can be quite powerful and therefore harm the interaction with Flowstone. Here's a list of standard input/output commands and methods that should be avoided:
Code: Select all
gets
p
print
printf
putc
puts
sprintf
warn


Additional kernel methods to be avoided:
Code: Select all
exit (i.e. Kernel::exit, Process::exit)
exit!
sleep
spawn
syscall

Re: Combination Circuits/Schematics

PostPosted: Fri Aug 11, 2017 11:09 pm
by tiffy
SELECTOR WITH OUTPUT: PROVIDING RUBY CODE TO MANIPULATE ELEMENTS IN ARRAYS:

Description how to use inside the Schematic.

P.S. I am working on a similar project for STRINGS as well, which when completed I will upload.

Re: Combination Circuits/Schematics

PostPosted: Sat Aug 12, 2017 12:10 pm
by tiffy
SELECTOR WITH OUTPUT:PROVIDING RUBY CODE TO MANIPULATE ELEMENTS IN STRINGS.

Pls note: I made the assumption that a sentence ends with one of the following characters: (. ? !)

I forgot to mention this on the description inside the schematic.

Description how to use inside schematic.

Re: Combination Circuits/Schematics

PostPosted: Sat Aug 12, 2017 5:32 pm
by BobF
Hi Tiffy,

Nice stuff as always. I hope someday soon I can make some good use of them.
Keep them comming.

Take care, BobF.....

Re: Combination Circuits/Schematics

PostPosted: Sun Aug 13, 2017 10:26 am
by tiffy
SIMPLE CALCULATOR (Picture Only):

I made this simple calculator which supports working with two decimal numbers but it can only do one calculation at a time. All the functions on the keyboard are functional...however, no fancy glitter like multiple stack or continuous memory etc.

Re: Combination Circuits/Schematics

PostPosted: Mon Aug 14, 2017 10:00 am
by tiffy
Analog World Time Clock (Picture only):

The main clock dial keep track of S.A. time Johannesburg whilst the other four smaller clocks are synchronized with it keeping time of the following: New York USA, London UK, Sydney Australia, Paris in France.

The clock has a hidden switch from where one can select 20 different shells as well as another hidden switch from where a digital clock with time, day of week, date, month, year and a snooze alarm can be selected and set.

I saw the physical clock hanging on the wall of my accountant and it was out of order long time ago. So I had a good look at it and when I got home I decided to give that old clock life again in the software world. I also gave my accountant a working copy on CD.