Accessing Net services with REBOL
THIS WEEK NetSpeak explores the salient features of the easily comprehensible but powerful scripting language that can be used to build your own tools to access different Net services without any hassle.
Net services such as Web, E-mail and NewsGroups are accessed with the help of respective client programs. For example, the browser is the Web client used to access a web page. But the drawback of employing such tools is that there are constraints imposed by limitations of the tools' features. Such tools may not always be the optimum solutions to accomplish a task.
For example, suppose you need to know only the total number of mails stored in your mailbox. Using a feature-rich mail client for this purpose will be an overkill. Again, where you want to know whether a web page is modified or not, a browser is certainly not an appropriate solution.
It is common knowledge that a variety of client programs are freely available for accessing such popular Net services as Web and E-mail and most PCs come with some of these programs pre-installed. But client programs for many less popular Net services are not readily available; you will have to hunt all over the Net to get an affordable tool. For example, to read newsgroup postings, you have to search the Net and download/install a newsgroup reader.
This means the availability and features of various client tools decide your access to different Net services. So, to gain reasonable autonomy in using various Net services according to your needs, you need a tool that will help implement solutions meeting your requirements. The script programming language, REBOL, is a brilliant product worth trying for such a purpose.
Relative Expression-Based Object Language or REBOL is a script language that can be used for wonderful applications with surprising ease. The learning curve of this language is so smooth that even a novice to programming can use it.
Many Net resources can be accessed with one or two lines of REBOL code as demonstrated by the following examples:
Suppose you want to send a web page (say with URL: firstname.lastname@example.org read http://www.somedomain.com/home.htm
With the domain name service (DNS) one can find the IP address of a machine on the Net. In REBOL this can be accomplished with this one liner: print read dns://www.hinduonnet.com.
In response to this command, REBOL will display the IP address of The Hindu site.
Most netizens know that the `whois' service can be used to find out the registration details of a domain name. With REBOL, you do not need a whois client program to retrieve domain registration details from an appropriate `whois' server.
For example, to get details of the domain name, `http://www.hinduonnet.com' through REBOL, type in this command at the REBOL command prompt: print read email@example.com
Before winding up this example section, let us have a look at a more complicated task that can also be accomplished with a single-line REBOL code. Suppose you have a web site and you want to append some text at the end of a web page.
Normally, this is done by editing the original file and later uploading the edited file using an FTP client. In REBOL, the whole process can be completed in a single go using a one-line instruction.
For example, you have a web page named `index.html' hosted at the FTP server `ftpserver.com' and you want to add the line `Latest Content' at the end of this file. In REBOL, the following command will serve the purpose: write/append ftp://your_ name: firstname.lastname@example.org/index.hrml "Latest Content''
By now you must have a reasonably good idea of the potential of this feature-packed product, available for free download. In fact, what was seen here is just the tip of the REBOL iceberg. You can find many such one-liners at the link: http://cobalt.reboltech.com/cgi-bin/oneline.r The salient feature of REBOL is that even though it has tremendous power and potential it is still not beyond the reach of an ordinary netizen. And as it is available on multiple platforms that include Linux and Windows, you can run the same script across various systems.
To download REBOL, which is a very small file, access the link:
http://www.rebol.com, move to the `Language' section and select the `Download' option. Now, move to the section labelled `REBOL/View' and access the download button. Installation is simple and when you start the program first you need to provide such network-related parameters as SMTP server address, POP address and the like. When you start the program, it loads with a graphical interface. To access the command-prompt, click on the icon labelled `Console'
A File locker
If you have to share your PC with others, you may like to keep your sensitive files away from them. You can use the "FileLock'' tool to password-protect your files/folders from intruders. During installation the program will display a password, which you have to enter when you run it the first time.
Once the program starts functioning, you can change the password using the `Set Password' option available at the main menu. Now, to lock the sensitive files, access the button `Add Files', add the files that are to be locked into the lock file list and press the `Apply Changes' button. For more details, checkout: http://www.geocities.com/lockfile/
Email the author at: email@example.com
Send this article to Friends by