Archive for the 'Scripting' Category

The Basics of XHTML Programming

Many of the pages that comprise internet websites are poorly written.  The main reason webmasters do not realize this is because even though syntactically inadequate HTML code may exist, it could still work in most web browsers despite not following the rules.  While today’s browsers are designed to deal with these inadequacies, the same cannot be said for the growing number of web-enabled mobile devices.  One technology that helps to promote the clean code and compliance needed to integrate the web and mobile environment is a technology known as XHTML.

XHTML Background

As the name implies, XHTML is essentially a combination of HTML and XML.  It represents a set of existing and future document types and modules that include all the elements of HTML combined with XML syntax.  The first version, XHTML 1.0, was recommended by the WC3 (World Wide Web Consortium) on January 26, 2000.  XHTML 1.1 was initially recommended on May 31, 20001.  As of now, XHTML 5.0 is currently in development under the HTML 5.0 specification.  Unlike HTML, these documents must be well structured and can therefore, actually be processed with basic XML tools.  Andrew S. Tanenbaum, a professor of computer science best known for authoring the Minix operating system, said that XHTML is a “very picky” language that distinguishes itself from HTML by way of a much more strict syntax.  This is assessment is right on point.

XHTML Syntax

One thing you should keep in mind is that XHTML is merely an extended version of HTML.  What this means is that writing XHTML code is essentially similar to writing in HTML.  The major difference is that XHTML is far more structured and more strict than its predecessor.  One of the best ways to learn this language is to experiment with some old HTML code and then work to bring it up to XHTML standards.  When working with the code, there are several important rules you need to remember, including the following:

- All elements must be nested correctly.

- All elements must be closed out correctly.

- All tag names must be entered in lower case characters.

- All attribute names must be entered in lower case characters.

- All attribute values must be quoted correctly.

- The name attribute is to be replaced by the id attribute

- All images and graphics must have alt (alternate) text.

- All XHTML documents require a DOCTYPE declaration along with an HTML head and body header elements.

- The title element must be included in the head element.

Learning XHTML is all about practicing and embracing discipline.  If you keep this in mind, you should be able to master it in a relatively short amount of time.  On the other hand, if you do not want to try manually converting an existing HTML to XHTML, you can use a software tool to perform the conversion for you.  HTML Tidy is a highly recommended program because it is a free tool that helps clean your web pages.  With such a handy tool at your disposal, you can get a handle on XHTML and use that knowledge to bring success to your projects.


Experimenting with HTML

If you want to be a good web developer or just a webmaster with moderate programming skills, HTML is a technology you need to familiarize yourself with.  In actuality, HTML is a very simple language, one that ties in code for virtually every website and communicates with every browser in order to display content to the user.  Here are a few tips to help you get more familiar with HTML and start comfortably working with the language on your own.

How to Learn HTML

There are a couple of ways you can learn HTML.  You can start by obtaining a piece of code from the web, saving it to your computer and doing a little experimenting.  Many suggest selecting a simple page, such as your home page and starting with that.

Using a browser such as Microsoft Internet Explorer or Mozilla FireFox, you can view the source code for just about any web page by right-clicking the page and choosing “View Source” or “View Page Source” from the sub-menu.  Once the code is visible on the screen, you can then save the entire page by clicking “File”, selecting “Save As” and giving the file a name.  You can also highlight snippets of the code, manually insert it into a blank document and then save it.  After doing this, you may want to insert the file in a folder to bring organization to your learning project.  When opening the page locally, you might notice that some of the graphics are missing because they were not saved with the HTML code.  If you want to work with these graphics, go back to the web page, right-click it and select “Save Image.”  You can then save it in the same folder you created earlier that contains the HTML file.

Now that you have the web page on your local drive, you can learn HTML by simply observing and editing the code.  You can get the results of these edits by keeping the page open in your browser and word processing application.  While you could use Word, Notepad is perfectly suitable.  If your browser is equipped with tabbed viewing, open a new tab for the project so you can go back to the original document on the web.  You may also want to arrange things where both the browser and Notepad windows are positioned where you can easily see both.  After making edits in the Notepad HTML file, save it and then refresh your browser.  The Notepad window will minimize automatically and give you just enough time to view the changes in the browser display.

Conclusion

This article is not intended to act as an HTML tutorial . Rather, we just want to express that the language is easy to work with and can be mastered by anyone who is willing to learn.  Most programmers learn HTML through trial and error.  With a little patience, you can do the same.


Is There a Way to Run ASP on Linux?

Over the years, ASP has become one of the most preferred server-side programming technologies for dynamic web pages and applications.  Tremendous power and flexibility makes it an ideal tool for a broad range of projects.  However, if you ask the average Linux developer their opinion about it, they will likely tell you one of the following:

- ASP cannot be run on a Linux-based server

- ASP is only available for Windows platforms

- All ASP modules for Apache call for code to be rewritten in Perl

More and more developers are discovering the benefits of ASP and as a result, more tools have been released to make the engine compatible with other languages.  Some have been serviceable, while others have been rather ineffective.   One tool that has proven to be highly efficient is Sun Java System Web Server 7.0.  With this application installed on the server, a Linux programmer can easily use ASP to complete their projects.

What is Sun Java System Web Server?

Sun Java System Web Server is a web server application similar in nature to Apache and Microsoft IIS.  It is currently one of the leading web servers on the corporate market, providing a streamlined infrastructure that supports virtually all web technologies and applications.  Many argue that the Java System Web Server performs notably faster than Apache and delivers better security than IIS.  Not only does it support the Linux platform, but other operating systems such as AIX, Solaris, Unix and Windows.  For ASP developers, this is a major advantage as they are no longer restricted to the Windows environment and can now broaden their talents and reach to different platforms.  Best of all, Sun released core components of the application as open-source under the BSD license, which means that the Java System Web Server can be freely obtained from the Sun Download Center.

Achieving ASP Compatibility

Sun Java System Web Server does not offer native support for ASP by default.  In order to make the two compatible you will need to use a special set of extensions.  These extensions are called Sun Active Server Pages, and version 4.0.4 must be installed on the system to obtain ASP functionality.  This tool can also be acquired from the Sun Download Center.  Unlike the web server, utilizing these extensions requires that you sign up for an account with Sun Microsystems.  The good thing is that creating an account is fast, free and easy.  Once you create your account and download the appropriate files, all it takes is a matter of minutes for the installation and automatic updates you need to run ASP.  From there, restart the web server and everything should be good to go.

Summary

ASP can now be used effectively in a wide range of web environments thanks to the cross-platform capabilities of Sun Java System Web Server.  This powerful web server offers developers the best of both worlds, blending the reliability and security of Linux with the power and flexibility of ASP.


The Benefits of Using Perl for Your Site

Originally released in 1987, the Perl programing language is not only ideal for creating dynamic web pages, but also performing a variety of system management task.  Unlike other languages, this one was designed to be efficient, easy to use and complete rather than tiny, elegant and limited.  If you want to know how Perl can aid your website, check out the scroll of benefits listed below:

Cleaner Code - With the introduction of Perl 5, it became possible to write code that is far more readable.  Once cryptic variable names can now be replaced with mnemonic identifiers.  Even the error messages are more informative and comprehensive while the optimal warnings will detect many of the mistakes made by novice developers.

Modularity and Reusability – The Perl 5 library is defined in terms of modules, components that can be easily shared between various packages.  A package can be made to import all or just a piece of a module’s published interfaced.  Pragmas, the compiler directives, can be defined and used by the same mechanism.

Object-orientated Programing – Perl supports dynamic inheritance and virtual methods in a simple and straightforward manner with very little new syntax.  Packages can function as classes and filehandlers can be treated as objects.

Highly Compatible and Extensible - Perl 5 can easily be embedded into C or C++ applications and can call or be called by routines through a documented interface.  Thanks to the provided IX preprocessor, you can easily glue C and C++ routines into the framework.  Dynamic module loading is supported and even Perl itself can be transformed into a dynamic library.

POSIX Compliant -The POSIX module is one of the latest Perl modules.  It provides access to all available POSIX definitions and routines via object classes when necessary.

Multi-Simultaneous DBM Implementation – A Perl program can simultaneously access DBM, GDBM, NDBM and SDBM from the same script.  Its DBMOpen interface has been modified in a manner that allows any variable to be connected to an object class that defines its access methods.

Auto Subroutine Upload - Aside from uploading, Perl’s AutoLoad mechanism allows you to define arbitrary semantics for any undefined subroutine call.

Regular Expression Enhancements – Perl 5 allows you to write regular expressions with embedded whitespace as well as comments for better readability.  The added extensibility mechanism is upwardly compatible with older regular expressions.

Innumerable Unbundled Modules – If you read the perlmodlib.manpage, you will discover that The Comprehensive Perl Archive Network contains a large number of plug-and-play modules containing reusable Perl code.

Compilable – Although a fully functioning Perl-to-C compiler does not exist, Perl 5 is capable of generating portable byte code, simple C or optimized C code.

Lexical Scoping - Perl 5 variables can be declared within a lexical scope, similar to auto variables in the C language.  Not only is this feature more efficient, but it also enables better privacy for your programming environment.

You can enjoy all the benefits Perl has to offer by downloading the free software package at the official Perl website or finding a web hosting provider with the language installed on their server.


Website Automation Programming Scripts

Today it seems that every other website owner is looking for ways to implement automated features into their site.  After all, these type of sites tend to be far more effective than those which are non-dynamic and simply present boring text.  Automated features cannot only make your site easier to use for visitors, but easier for you to manage as well.  There are many ways to achieve automation and almost all of them require the use of client-side or server-side scripting.

Common Usage

When it comes to web programming and development, there are a number of specially designed scripts written a language specific to their underlying software packages.  Many client-side scripts such as web browsers are written in Java, which is one of the most widely used programming languages.  CGI, Perl and PHP are some of the most popular server-side technologies.  While CGI offers many features that can provide your site with automation, Perl and PHP are newer languages, and thus faster and higher demand by website owners and developers.  Some of the functionality these scripts offer include:

Shopping Carts - Some of the best e-commerce shopping carts are written in CGI.  This technology is capable of communicating with popular databases like MySQL and as well as MS SQL and Access, making it compatible with Linux, Unix, Windows and Mac OS X platforms.  Other languages used to create shopping cart programs include PHP, Python and ASP (Active Server Pages), a server-side programming framework created by Microsoft.

Form Managers – Many of the forms you view on a website are powered by CGI.  This includes those filled out by customers when they make a purchase.  In most cases, this is a very seamless process as all the customer does is enter their details into the form and click the “submit” button.  From there, CGI goes into action, sending the data to an email address or database where it can be accessed by the website owner.

Pass Protection – Some website owners require that users enter a user name and password before they access a particular area of their site.  This could be the criteria for several motives such as tracking new visitors for marketing purposes, allowing site members to participate in a community forum, or confirming that a customer has completed a purchase to access downloadable products.  The use of CGI scripts is one of the most common ways site owners setup registration that requires users to login with a user name and password.

What’s Your Language?

Scripting languages are abundant and you have several to choose from.  Aside from the scripts mentioned in this article, you can also get automated features with technologies such as Ruby on Rails, Cold Fusion, Server-Side Javascript and many others.  CGI scripts are among the easiest to use as they are pre-scripted and generally come installed and ready use on the hosting provider’s server.  While languages such as PHP and Perl are more difficult to use, they also offer more power and functionality.  Whatever language you choose, you are sure to enjoy a feature-rich website that gives you an edge over the competition.


« Prev - Next »