Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Alfredo Fernández Díaz

Pages: [1] 2 3 ... 6
1
Hi Dan, given the thread subject, "out of the box", I'm not sure what you mean by "fairly quickly" -- shouldn't that be the point? Unless... are you absolutely new to OS/2 / ArcaOS? If that's the case,

perhaps the first thing ArcaOS needs to have in its Development folder (REXX Folder?) is simply a 'Hello world' Rexx program object to be run, another program object specifically to show how it's done ("Edit Hello World!"), and the shortest readme / intro ("What is REXX?"):
----8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<----
REXX is the default scripting language in ArcaOS. To start creating REXX programs, you just need a plain text editor and the ability to read the simplest English (click on Edit "Hello World!").

Once you save your REXX scripts you can run them simply double-clicking on them, or typing their name at the command line from the folders where you have created them.

ArcaOS comes with <this and that>, please see <X, Y, Z, under ... > (pointers to a selection of the included materials best suitable for new users).

2
Programming / Re: VisualAge C++ 3.6.5 (+ Fix2) - WarpIn or RPM?
« on: February 27, 2025, 10:13:06 pm »
is there a way to assign the PNG file?

According to Dynamic Icons help, the only direct method is interactive (good ol' drag'n'drop, with the Icon type radio button set to "PNG"), not programmatic (e.g. via setup strings). Time for an RFE? ; )

Indirectly, you need to add your icon file to %BIGICONSPATH%, find "bigicons.txt" there and add a line like
"<MyObectID>"  "MyBigIcon.png" to it under the [OBJECTID] section.

3
I thought that invoking as time.cmd instead of time would run the script.
So did I, but I seemed to recall there was some reason why it was best not to do that kind of thing. I can't imagine what kind of bright mind would consider that behavior "working as designed", but I tried under 4os2 and I got the same result, so I won't call it a bug...

It seems that at least CMD and 4OS2 (haven't JdeBP's 32-bit cmd installed to test right now) will ignore batch or rexx .cmd files that you call the same as some internal command, and ".cmd" plus the rest of your command line will be fed as parameters to the internal command.

Rather than debating the wisdom of said course of action, I'd insist on the question:

What if I want to replace internal commands with my own stuff anyway?

And fortunately the answer may seem slightly awkward, but at least it works:

To launch your own rexx replacements instead of internal commands just put them in double quotes, e.g. "time.cmd". If you needed to quote your arguments, quote them again for this: "time.cmd" "make clean > report.txt".

4
Thanks for the better formatting.
; )

Quote
I tried running the above snippet after saving it as time.cmd and got,
Code: [Select]
K:\work\dooble\obj>time.cmd make clean
SYS1044: The system cannot accept the time entered.

Enter the new time:

Same with quoting the make clean.
Sounds like you're getting some other "time" invoked instead (see "help 1044"). Save as something else and retry, to make sure?

5
Wait, there's a proper use for the code tag in forums?! LOL
Thanks for the tip, Dave! : ))

6
Programming / Re: time during compiling
« on: February 26, 2025, 08:14:21 pm »
Hi TeLLie,

just in case you want to have a look, i have posted a simple solution for this in the REXX tutorials thread.


7
Code snippet #2: timed command

Rationale: one good thing about REXX is that it lets you use system commands in your code, which makes integrating both very easy. It is sometimes interesting to know how long some commands take to complete, so why not use some simple REXX to execute them and find out?

This REXX code will take its execution parameters as a command to be executed as is by the system shell, will report the time elapsed, and pass along its exit (return) code:

Code: [Select]
/*
  Timed Command: executes its invoking parameters as an
  external system command, and tells how long it took
*/
parse arg command

/* Depending on command output, this may go off-screen > repeat at the end */
start = time()
say 'Starting "'||command||'" at '||start
call time 'E'  /* start timer */

/* Single literals execute as commands */
'@Echo Off'   
command       
cmdrc = rc     /* save return code */

say 'Command: "'||command||'", '||,
    'started at '||start||', ended at '||time()||'. '||,
    'Elapsed: '||format(time('E'),,2)||'s.'
if cmdrc <> 0 then /* simple warning */
  say 'Non-zero exit code (error?): '||cmdrc

exit cmdrc /* RC is passed along regardless of value */

Some refinements are possible. For example, time can be formatted if too many seconds are uncomfortable to read:

Code: [Select]
[...]
say 'Command: "'||command||'", '||,
    'started at '||start||', ended at '||time()||'. '||,
    'Elapsed: '||t2hms(time('E'))||'.'
if cmdrc <> 0 then /* simple warning */
  say 'Non-zero exit code (error?): '||cmdrc

exit cmdrc /* RC is passed along regardless of value */

t2hms: procedure
  parse arg t
  h = t % 3600
  t = (t // 3600)
  m = t % 60
  s = (t // 60)
  t = format(s,,2)||'s'
  if (m > 0) then do
    if (s < 10) then
      t = '0'||t
    t = m||'m:'||t
   end
  if (h > 0) then do
    if (m < 10) then
      t = '0'||t
    t = h||'h:'||t
   end
return t

What if commands include redirection?

Some commands are most useful when executed redirecting their output to a file, e.g. "dir > filelist.txt", but executing "TimedCmd dir > filelist.txt" will include TimedCmd output in filelist.txt in the example, which may not be desirable.

To adress such situations, the whole command must be in quotes so it is passed as a single parameter for execution leaving the redirection to be processed later, i.e. TimedCmd "dir > filelist.txt" in the example above. However, the quotes must be removed from both ends so the system shell will break the command again to carry on the redirection, instead of looking for a file called "dir > filelist.txt" to execute:

Code: [Select]
[...]
parse arg command
command = strip(command,,'"')
[...]

Edit: tt -> code

8
Jan-Erik, Gordon, thank you both for your input.

I think code snippets for tutorials should be as simple and straightforward as possible so as to show one way to address the task at hand and get it done right away.

As you point out, however, anything worth doing can probably be done in a number of ways, and different developers can find places in any listing where adding / replacing some code can improve the whole thing, so I'll ammend the above by adding "initially". Just like classes on the same subject are always the same yet always a little bit different if only because of the audience, different people will take away slightly different things from one tutorial so it is probably a good idea to have different code listings to illustrate possible alternatives or whatever. That's the spirit!

Putting everything together, maybe this could be better done in the form of a simple initial listing, plus additions to expand on obvious or non-obvious places. Let's try that with another REXX snippet...

9
Events / Re: ArcaOS 5.1.1 is out.
« on: February 23, 2025, 06:30:26 pm »
Has anyone used the "new VNC Server" which is said to be "available"?
I cannot even find it or the client.

There. The outside system has the viewer connected to another system running at a lower resolution, with the server properties notebook open.

Did you check "VNC server" during installation? I can't recall whether it is selected by default.

Edit:
[...]dbl-click either 'VNC-P4.WPI' or 'VNC-I686.WPI'.
I remember now that it is not, and this is probably why.

10
I imagine we can start with something rather basic and see if can give this some shape so it is useful for those who might find the relevant parts of the crexx reference overwhelming or otherwise unappealing.

The following procedure

Code: [Select]
/**/
parse arg where
call lineout where,'     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5'
do i=1 to 15
  call charout where,' '||right(i*16,3,' ')
  do j=0 to 15
    call charout where,' '||d2c(i*16+j)
  end
  call lineout where,' '||right(16*i+15,3,' ')
 end
call lineout where,'     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5'
call lineout where
exit

will print out the following ASCII table:

     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  16                  31
  32   ! " # $ % & ' ( ) * + , - . /  47
  48 0 1 2 3 4 5 6 7 8 9 : ; < = > ?  63
  64 @ A B C D E F G H I J K L M N O  79
  80 P Q R S T U V W X Y Z [ \ ] ^ _  95
  96 ` a b c d e f g h i j k l m n o 111
 112 p q r s t u v w x y z { | } ~  127
 128 Ç ü é â ä à å ç ê ë è ï î ì Ä Å 143
 144 É æ Æ ô ö ò û ù ÿ Ö Ü ø £ Ø × ƒ 159
 160 á í ó ú ñ Ñ ª º ¿ ® ¬ ½ ¼ ¡ « » 175
 176 ░ ▒ ▓ │ ┤ Á Â À © ╣ ║ ╗ ╝ ¢ ¥ ┐ 191
 192 └ ┴ ┬ ├ ─ ┼ ã Ã ╚ ╔ ╩ ╦ ╠ ═ ╬ ¤ 207
 208 ð Ð Ê Ë È € Í Î Ï ┘ ┌ █ ▄ ¦ Ì ▀ 223
 224 Ó ß Ô Ò õ Õ µ þ Þ Ú Û Ù ý Ý ¯ ´ 239
 240 ­ ± ‗ ¾ ¶ § ÷ ¸ ° ¨ · ¹ ³ ² ■   255
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5


Notes (before you tackle the full rexx reference):
-The procedure can print to a file using the filename as a parameter. If omitted (empty), the table will be printed to screen. Individual instructions "charout" and "lineout" do the same.
-Characters are produced sequentially according to their codepoint number because there is a simple way to convert numbers to characters. Check "d2c".
-Initial and final reference values are padded on the left to take up 3 spaces and stay aligned on the right. Check "right".
-The actual characters shown depend on system codepage. Try this on a separate session after the command "CHCP <secondary codepage>", and compare.
-Should it be mentioned that the two nested loops for rows and individual cells within each row need two different indices, but that these can be used separately and together (e.g. to calculate the code for each current char)?

As you see, the idea is that we take some simple task (for the level considered), complete it with a minimal set of basic instructions, and comment on some aspects that being interesting can be easily overlooked when reading a full reference. Rinse and repeat with more advanced stuff.

Does this look any good to you? What would you improve? Post your own, better examples ; )

Edit: tt -> code

11
Hi Dariusz, Steven, Jan-Erik, Dave, Lewis -- that's the idea!

Well, so for the moment being and me cRexx it is, as it is available for everyone by default, and I expect by the time any advantages of (o)oRexx become a necessity for people, they should be able to simply switch from tutorials to reference manuals -- mind you, of course any comments on how 'the same can be done with less --or otherwise better-- (o)orexx code like this' are most welcome!

As Dariusz pointed out, it is always an excellent idea to have a bibliography covering any subject at hand in depth, either in the form of the books themselves if available, or at least a list, so thank you for that. However, I think the best tutorials, while referring to appropriate materials where everything is covered in full, do at the same time keep their own stuff at a minimum to ensure everything can be grasped in one go.

Every year I find myself having to match syllabi/syllabuses which are impossibly broad and deep to the corresponding exams, so you see where I come from. Rather than going for the mechanical 'recipes for exercises' approach, every year I have a(nother) go at condensing (butchering, really) each subject in such a way that students will stand some chance to do well at their exams while it still makes sense as a whole for those who really want to understand -- with any luck, I'll have enabled some to pick up a book and make sense of the real stuff when laid out in proper depth. I like to think I slowly get better at it, so let's see what we can do here... ; )

12
Programming / Re: Classic, Regina, Object and Open Object Rexx
« on: February 22, 2025, 08:56:27 pm »
Quote from: RexxUtil.inf
SysSaveRexxMacroSpace( file )[...]
Saves all functions in the REXX macrospace to a file. These functions can be loaded again later[...]
It's not directly editable or in plain text,
Bummer : /

I used to use PPWizard to keep a Rexx code library of sorts for my bigger scripts or bits that were likely to change. Testing Sys*Macro had been on my to-do list since I first read about them in RexxUtil.inf (rexx.inf does not mention them), but never got round to it, and now I never will.

Quote
The benefit of Object Rexx and ooRexx is that one can write rexx code in a plain text file and call one or more functions[...]
You bet, sold : )

I find it interesting that while 'tokens' appear in cRexx messages up to 5 times, they are mentioned only once in Rexx.inf (and never in rexxutil.inf). It should come as no surprise then that many (most?) people never get to even know about the tokenization process -- it took me ages to get deep enough to practically need to learn about it, and then I had to google it up. I'd have been more than happy to have it explained in the original documentation, even in passing.

13
Programming / Re: Classic, Regina, Object and Open Object Rexx
« on: February 22, 2025, 02:42:43 pm »
OK, to try and not derail this thread so we can further consider the feasibility of modernizing REXX support in ArcaOS, there you go: a new thread for REXX tutorials ; )

14
I think it is a shame that the default ArcaOS 5.1.1- installation has a 'Development' folder... populated with the single lonely 'Rexx console' object pointing to PMRexx. While somebody should try and convince the guys at ArcaNoae that 'less is more' does not apply in this case (don't we want more programming languages?), can't we tell them here and now how to improve what's currently available? Even better, can we show them? ; )

Let's start with extremely simple things: make more stuff visible by adding it to the Development folder!
1. RexxTry (a procedure that lets you interactively try REXX statements) is localized in ArcaOS 5.1.1 -- so, don't you want users to know it's there? Add "Try Rexx!" (both VIO and PM, using the 'REXX Console'!) objects.
2. Doesn't the system include a gazillion system and additional REXX libraries already? Why not have a shadow of the "REXX scripting language" folder right next to the other REXX objects in Development, so only the illiterate can miss the information?

OK, that was the obvious. Now, from another thread... tutorials?!:

I see that the knowledge of REXX is somewhat limited even with OS/2 users.
[...]
So what can one do with REXX you wonder?
Alex Taylor has for example written some excellent software that you may have used, both command line scripts and GUI applications like Naps and ANPM to mention a few.
Glassman wrote AutoWGet that is very helpful to fetch things from the internet
and much more...

I use ooRexx to automatically create documents with maps to send to owners of land at work, drive office applications, vector drawing applications such as OpenOffice Draw, Calc etc. split/merge/extract text PDF documents with GhostScript and retrieve routes from google between places etc.

I myself have written a few dozens of simple rexx programs. While they may not be spectacularly useful for everyone I wrote them in REXX with the idea that anyone could see right away how stuff is done, and maybe this could pique the interest of more people (or new users?) than what is currently included with the system -- who doesn't like a good tutorial? So, I could try and turn what I have into one <g> if you guys think it could be of interest and are willing to provide useful feedback.

[...] I would welcome any additional tutorial material to help me improve [...]

So, I propose to post here applets, code snippets, and anything REXX really, aimed at
1. Usefulness for less experienced users or developers who may be scratching their heads wondering 'OK, the reference is fine, but how do I...?', or 'how does one put together X and Y?', etc.
2. Creating some fine multi-level tutorial worth being included in next releases of ArcaOS.

I will try and put together a few usable examples. Meanwhile, do not hesitate to share your knowledge here, or simply comment on how what's being posted could be improved for you!

15
Events / Re: ArcaOS 5.1.1 is out.
« on: February 22, 2025, 12:32:43 am »
Actually I do it programmatically for every installed system, deleting the XCenter and creating a new one with the following setup string:

POSITION=TOP;BORDERSPACING=0;REDUCEDESKTOP=YES;WIDGETS=XButton(),TasksWidget(),ObjButton(OBJECTHANDLE%3D<XWP_LOCKUPSTR>%3B),ObjButton(OBJECTHANDLE%3D<XWP_FINDSTR>%3B),ObjButton(OBJECTHANDLE%3D<XWP_SHUTDOWNSTR>%3B),Pulse(WIDTH%3D154%3B),Tray(BGNDCOL%3DCCCCCC%3BWIDTH%3D134%3BCURRENTTRAY%3D0%3B){Tray  1[ObjButton(OBJECTHANDLE%3D<WP_DRIVES>%3B),ObjButton(OBJECTHANDLE%3D<WP_CONFIG>%3B),ObjButton(OBJECTHANDLE%3D<WP_PROMPTS>%3B)]},WindowList(BGNDCOL%3DCCCCCC%3BTEXTCOL%3D000000%3BFILTERS%3DSysBar/2 Pipe Monitor#~^°@lSwitcher#~^°@FTP server%3B),Power(BGNDCOL%3DCCCCCC%3BTEXTCOL%3D000000%3BWARN%3D15%3BREPEAT%3D5%3B),ObjButton(OBJECTHANDLE%3D<WP_ASSISTANCE>%3B),ObjButton(OBJECTHANDLE%3D<C:\Sys\bin\calendar.exe>%3B),XWLANMonitorWidget(),Time(BGNDCOL%3D000000%3BTEXTCOL%3D00FF00%3B),AN_RemMedia();OPEN=26599;OBJECTID=<XWP_XCENTER>;

but you can also do it by hand, dragging colors from the Solid Color Palette (folder Appearance under System Setup) to drop them onto the Time widget. Ctl+drag to change the foreground, simple drag for the background.

Pages: [1] 2 3 ... 6