Comments on: Quick Tour of Useful 2.7.8 Features
REBOL Technologies

Comments on: Quick Tour of Useful 2.7.8 Features

Carl Sassenrath, CTO
REBOL Technologies
16-Jan-2011 19:37 GMT

Article #0505
Main page || Index || Prior Article [0504] || Next Article [0506] || 5 Comments || Send feedback

I've been incredibly busy... and it took a week to get the list of changes updated on this website. The list is done now, but let me give you a quick overview of some features.

First, if you use REBOL as a server or for CGI-scripting, notice there's only one task running now:

rebol@linux:~$ rebol &
rebol@ub10:~$ ps
 PID TTY          TIME CMD
1474 pts/0    00:00:00 bash
1703 pts/0    00:00:00 rebol
1704 pts/0    00:00:00 ps

The DNS subtask is delayed now until you use DNS (which many scripts may not need.) This change makes your CGI scripts launch faster and also makes it possible to setuid the main process before the subtask forks.

There are also new functions for easier access to the OS environment. Notice that the secure level defaults to asking the user for permission:

>> set-env "prog-home" "/tmp"
REBOL - Security Check:
Script requests permission to access OS environment: prog-home
Yes, allow all, no, or quit? (Y/A/N/Q) A
>> get-env "prog-home"
== "/tmp"

Of course you can allow such operations with:

secure [envr allow]

or by running with the -s option.

Notice also, the list-env function:

>> list-env
== [
   "ORBIT_SOCKETDIR" "/tmp/orbit-rebol" 
   "SSH_AGENT_PID" "1327" 
   "TERM" "xterm" 
   "SHELL" "/bin/bash" 
   "XDG_SE...

You can also access special OS related settings on Posix systems. For example, if you're running a server as root to obtain a listen port on 80, it's wise to setuid the process to some other account:

access-os/set 'uid 1001

Or, if you need your process id for something like building a lock file, you can get it with:

pid: access-os 'pid
save join %/tmp/lock- pid pid

Brian Hawley also ported over a number of useful R3 functions. The full list is here.

For example last? mezzanine is useful:

>> list: [a b]  
== [a b]
>> last? list
== false
>> remove list
== [b]
>> last? list
== true

The various R3 Unix-like shell functions come in handy when you're working from the REBOL console:

>> cd %/usr/local
== %/usr/local/
>> ls
bin/      etc/      games/    include/  lib/      man/      sbin/     
share/    src/

I use dt (delta-time) a lot for measuring performance:

>> dt [loop 1000000 [next "a"]]
== 0:00:00.246217

Speaking of which, I've added a new speed? function, but that's the subject for a separate blog. It is preliminary, so don't yet depend on it.

5 Comments

Comments:

Gabriele
17-Jan-2011 3:34:18
Should ACCESS-OS be a separate function, or should these things be accessible through the SYSTEM:// port, or rather should some of the things that are accessible through the SYSTEM:// port be moved over to ACCESS-OS instead? (Not sure how much this has been discussed already, just wanted to point it out.)
buddyontobuddy
4-Jul-2012 10:26:11
Your article shows tells me you must have a lot of background in this topic. Can you direct me to other articles about this? I will recommend this article to my friends as well. Thanks sit
omexiored
9-Jul-2012 6:36:24
Your knowledge of this subject comes through clearly in this article. I love to read this kind of articles, I hope you will update it. Thank you for sharing it with me. Mertie Joyce
chanmeya
9-Jul-2012 8:31
This is a well written article on this subject. I have been looking at starting a new business and this is valuable information to help me in my decision. Thank you. betta care
ZeeTv
15-Jul-2012 21:58:53
Wow! I really appreciate the thought that you put into this article. This topic has been something I have been looking into for a few hours and your post is one of the best I have read. Dallas Security Service Company

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

CS-0505


Comment:


 Note: HTML tags allowed for: b i u li ol ul font p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 15-Dec-2017   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code