Categories
Technology Writing

Creating C# Applications: Chapter 3

When I work with more than one programming language at a time, such as Java and Perl or VB and C#, the biggest problem I have keeping the languages untangled is remembering to use a semi-colon (;) or not when ending the statement. No matter how hard I try to keep my language syntax separate, I always include the semi-colon when I shouldn’t (such as in VB), or not include it when I should (such as in C++ or Java or C#).

Regardless of the sophistication of a programming language, you must first become proficient with the operators and special characters supported in the language before advancing on its more escoteric elements, and this chapter provides coverage of C#’s operators and special character set — including the infamous semi-colon.

Arithmetic and Concatenation Characters

The simplest of the operators for C# are the arithmetic operators. The addition operator (‘+’) is used to add two numbers together, as it’s used in most other programming languages, such as C++. In addition, the + operator is an example of an overloaded operator within C#. What this means is that you can use it for adding numbers and you can also use it to add two strings together (concatenation), or add a string and a number. An overloaded operator is one that can work with different parameters, or parameter types. C# extends this capability by also translating parameters to compatible types — such as converting an integer to a string for concatenation when adding a string and an integer.

To demonstrate this capability, in the following code, the addition operator is used to add two numbers and two strings and print out the results of both operations.

using System;

class ArithTest 
{
   public static void Main() 
   {
        int i = 6;
	     string s1 = "Value";
        string s2 = " is ";

        // add two numbers
        i = i + 4;
        
        // add two strings
        s1 = s1 + s2;

        // add a string and a number
	     s2 = s1 + i;

        // output values
        Console.WriteLine(i);
        Console.WriteLine(s1);
        Console.WriteLine(s2);
      
   }
}

The result from running this application is:

10
Value is
Value is 10

The plus sign can’t convert automatically between the two operands if the result is ambiguous, or disallowed for implicit type conversion. If you try to add a double to an integer, as shown in the following line of code:

i = i + 4.15

An error results when you compile the application because you can’t implicitly convert a double to an integer.

The addition operator can also be used to perform delegate concatenation, covered in more detail in Chapter 10 “Delegates and Events”.

The addition operator is both a binary operator, meaning that there are two operands for an expression containing the operator, and a unary operator. A unary operator applies to only one operand. Applying the addition operator as a unary operator to an operand just returns the value of the operand:

nVal = i+;

The subtraction operator (‘-‘) is used to subtract one number from another, or to negate the value of an operand, as demonstrated in the following code:

using System;

class ArithTest 
{
   public static void Main() 
   {
        int i = 6;

        // subtract smaller value
        Console.WriteLine(i - 2);

        // subtract larger value
        Console.WriteLine(i - 7);

        // unary
        Console.WriteLine(-i);
      
   }
}

The following values are output when this application is run:

4
-1
-6

The subtraction operator, as with the other arithmetic operators, works with all numeric data types, such as integers, doubles, and decimals.

The multiplication operator (‘*’) multiplies two operands together, while the division operator (‘/’) divides the first number by the second. The modulus operator (‘%’) returns only the remainder after the first operand is divided by the second.

In the following code, each of the operators just described is used between two different operands, both of which are type double, and the results are printed out:

 
using System;

class ArithTest 
{
   public static void Main() 
   {
        double d1 = 4.15;
        double d2 = 1.23;

        //  multiply
        Console.WriteLine(d1 * d2);

        // divide
        Console.WriteLine(d1 / d2);

        // modulus
        Console.WriteLine(d1 % d2);
      
   }
}

The output of this application is:

5.1045
3.3739837398374
0.46 

The multiplication operator is another example of an overloaded operator; it’s also used when declaring pointers, and de-referencing these pointers to access the pointer values as you’ll see in the section “Membership, Array, and Casting Operators” later in this chapter.

With all arithmetic operations, if an overflow occurs because the result is too large for the allowed range of the data type, an OverflowException is thrown if one of the following conditions is met:

  • The checked compiler option is used and
  • The data types of the operands are integers (int, long, or ulong)
  • Or the operands are decimals

Use the checked compiler option when compiling the application in order to generate an OverflowException with integers. This compiler option turns on arithmetic checking:

csc /checked test.cs

In the following C# application, the OverflowException is captured and the error message printed out:

 
using System;

class ArithTest 
{
   public static void Main() 
   {
        int i = 2147148000;
        int i2 = 32000;

        try 
        {
           //  multiply
           i = i * i2;
           Console.WriteLine(i);
        }
        catch (OverflowException e)
        {
           Console.WriteLine("{0}", e);
        }
      
   }
}

When the application is compiled without the checked option, the following output results:

2144165888

Since integer arithmetic checking isn’t turned on, the significant high-order bits are discarded, and the resulting value is returned. When checking is turned on with the check compiler option, the following exception message is printed out:

System.OverflowException: An exception of type 
   System.OverflowException was thrown.
   at ArithTest.Main() 

The OverflowException will occur with all decimal values when the value is too large for the decimal format.

Float and double values don’t generate an overflow exception. Following the IEEE 754 arithmetic specification, values too large for the variable are set to infinity. If a value can’t be defined as a numeric, it is given the constant NaN — meaning Not a Number.

Arithmetic and concatenation operators are useful for converting values, but have no impact on an application’s process. In addition, each of the variables modified by the operators in this section first had to be assigned. Program flow controlled through the use of logical and condition operators and the assignment operators are discussed next.

Categories
Technology Writing

Creating C# Applications: Chapter 1

Introduction

There’s been considerable material on programming C# within the Visual Studio .NET environment, but not as much on C# as the first programming language based on the Common Language Infrastructure (CLI).

This online C# book provides an introduction to C#, the programming language. In addition, the book also takes a look at the CLI as well as the Common Language Runtime (CLR), using C# to demonstrate the various aspects of this standards-based development environment.

We’ll explore CLI/CLR in more depth in other chapters, but for now, to get you started, we’ll take a look at the basics necessary to get you up and running with C#.

The Basics

You can’t work with a programming language without learning the basics of creating an application in that language. Some languages, such the version of Basic found in Visual Basic, are a language and development environment tightly bound into one tool. Others, such as C++, can be bound to a development environment (ala Visual C++), or can be worked with using command line compilers and standard text editors, such as C++ within a Unix environment.

Fundamentally, you need to learn how to create the simplest form of an application in the language, compile it, and then run it. Once you have this information, you can then vary your program as you learn new and different aspects of the language.

This chapter provides an overview of how to create and compile a C# application using the minimum environment — in this case, using the .NET Framework SDK that’s downloadable, for free, from the Microsoft web site.

The Structure of a C# Application

Before installing the C# support environment, let’s take a look at a minimal C# application.

A C# application can consist of one or more modules — separately compiled functional units that don’t have a main entry point — libraries (comparable to COM components), and at least one application entry point. A C# file has an extension of .cs, and may, or may not, contain a Main application method.

A minimal C# application can have the following format:

using System;

class someClass
{
   public static void Main() 
   {
   }
}

As you can see, a minimal application doesn’t require a lot of code, requiring only the following:

  • A reference to the System namespace
  • A class
  • A main function within the class, that’s called when the application’s run

Applications written in C# access external functionality through the use of namespaces — a container for classes, structs, types, and other useful programming goodies (namespaces are described in greater detail in a later chapter, “C# Scoping and Namespaces”).

C# files contain one or more class definitions. In addition, the files can also contain other C# elements such as interface definitions, delegates, and enumerations. A stand-alone application also has a Main function, called when the application is run. However, to create and run the application, you first have to install the environment.

The C# Environment

As with Java, C# is dependent on a runtime environment being present in order to support the language. Java depends on the Java Virtual Machine (VM) and C# is dependent on the Common Language Runtime (CLR), a set of services providing security, type safety, cross-language exception handling, garbage collection, and other features. An application that contains code meant to be managed by the CLR is known as managed code; code outside of the CLR control is know, appropriately enough, as unmanaged code.

There are five different CLR hosts that support managed code:

  • ASP.NET (for server-side Web access)
  • Internet Explorer (for code implemented within the boundaries of the browser)
  • VBA (for script executed within the confines of Outlook or Office or other VBA enabled applications)
  • Windows Form Designer
  • Windows Shell EXE (for applications launched by a command line)

The last CLR runtime host is the one we’ll be using throughout this online book, primarily because this host allows us to focus on C# as a language, rather than C# as being part of ASP.NET or Web Services, and so on. Once you have a command of the language, then you can explore the other more complex uses of the language, such as those just mentioned.

In addition, you’ll be using the command line compiler when creating each of the test applications rather than creating the examples within Visual Studio. Again, this puts the focus on the language rather than the development environment. However, to run the application, you first have to compile it, which means you have to have both the infrastructure and compiler installed on your machine.

Categories
Writing

Bits of prose

A long time ago in a place far, far away, and long before I started writing articles and books on computer technology, I used to write poems. Well, I called them poems.

Recently, I found a folder of poems and decided to put my three favorite online. I’m aware that this could result in a mass exodus from Books & Bytes, but what the hey, we all have to live on the edge sometimes.

One poem is about breaking up; one was written in protest of war and conflict; and one is about the Holocaust. Three different subjects with one common theme of loss — from the personal to the profound.

Letting Go

This poem is about breaking up and landing on your feet.

Love Lost. Letting Go. We hold on with clutching, grasping hands.
Desperation. It really does hurt.
     Grasp a rose, and let the thorns sink deep.
     We choke the flower through fear of the release.
        As if...
            we can stop....
                 the pain...
     By not letting go.

Letting Go. It means loss and loneliness. 
What will I do without this person? 
I can't imagine life without him. It's really 
hard to smile and laugh and to enjoy just 
getting up each day.
     Hello sunshine and good-bye and 
     please go away.
     I would rather have clouds right now,
     okay?
        As if...
            we can stop...
                the pain...
     by enjoying it.

Enjoying it? Yes! We throw ourselves into the loss and live within it.
That will show him! Look at what he has done to me! 
But guilt is an odd sort of weapon.
     With guilt as the hook and 
     self-pity as the line,
     the fisherman may catch a fish,
     that bites back. 
        As if...
            we can stop...
                the pain...
     by using tricks.

Tricks belong in magic shows, not in love. 
If you use tricks to keep a love alive, eventually it 
will turn ugly.
And then what will you have?
    The beauty of the dreaming is in the 
    waking.
    Then you have something to carry 
    with you all day.
        As if...
           we can stop...
               the pain...
    by remembering the joy.

You can hold love within a memory. Tuck a little away 
somewhere in your mind. Bring it out to give yourself a smile
sometimes. 
It's hard now, but it will get easier. 
Sometimes the true test of love is not the having,
but the loosing. 
Choose to walk away a better person.
    Walking away.
            You can...
               You can stop...
                  the pain...
     by just letting go.

Tommy Joe is Dead

I wrote this poem a long time ago, and it included references to violence in Tel Aviv and Rhodesia — hot spots at the time. I’ve modernized the references, but unfortunately, the sentiment is still fresh.

Tommy Joe is Dead.

Some would call it fate,
he died that day, that way,
that year.
Others would call it bad luck.
Those who loved him can only cry,
shake their heads and wonder why.

Tommy Joe is Dead.

Mom and Dad had high hopes, 
their boy would be the best.
All their frustrated dreams 
would be lived by him, through him.
He would be what they wanted to be,
and never dared.

Tommy Joe is dead.

Carrie was his love, his hope,
his future mate.
Together they would change the world,
make the world;
high hopes only youth can feel,
high dreams only youth can dream

Tommy Joe is Dead.

He could be your lover, your brother,
son or friend.
He could have been your father 
if fate, or luck, had been different.
He is a memory now, perhaps forgotten,
that most noble soul -- 
a person who died for a cause.

Tommy Joe is Dead.

He died in the jungles of Nam,
the streets of Ulster;
a young boy shot down in Uganda.
A nameless face, a faceless name,
all for a cause.
How sad, a young life wasted.

Tommy Joe is Dead.

The Burnt Offering

The television mini-series “The Holocaust” was first telecast when I was going to college. A history teacher at the school had a three day class on the Holocaust that I attended.

On the last day of the class, the teacher had us go to an auditorium where he showed film after film of the atrocities committed by the Nazis.

I attended the showing with a close friend who was Jewish, and she broke down in sobs during the films but wouldn’t leave. None of us could leave. Aside from the people crying, there wasn’t a sound in that auditorium — not a sound.

The poem “Burnt Offering” was a result of this day. I’ll never forget. Will you?

My eyes have been opened.
I can no longer plead ignorance 
because I know, and that knowledge 
will not leave me!

A thousand voices cry out, 
"Do not forget us, Remember!"
A million faces haunt my dreams.
The responsibility is mine -- 
not to forget, the Curse of Man.

We turn from the ugliness,
not in disbelief but in recognition.
We fear our inner animal.
To see ugliness in others,
is to see it within ourselves.

We fear that which is different.
We fear ourselves, and what 
we can do.
And we fear these fears, 
and hate steps in.

We turn from knowledge; the 
price of knowledge is responsibility.
We don't know if we have the strength
to accept, so we turn.

I will turn no more!
I will learn, though 
learning is pain.
And I will not forget the warning,
of the Burnt Offering.
Categories
Web Writing

Dynamic Web Publishing Unleashed: Chapter 37 – the Future of Web Publishing

Recovered from the Wayback Machine.

IN THIS CHAPTER

  • The Chaos of Change
  • The Current Technology Platform
  • A Summary Review of the Technologies Covered in the Book–Where Will They Be in a Year?
  • Client Scripting and CSS1 Positioning

With an industry that seems to go through a new revolutionary change at least four times a year, it’s hard to predict where Web publishing will be in four months, much less the next couple of years. However, taking a look at existing technologies and their state and at some new technologies can give us a peek through the door to the future, even though the crack we are peeking through might be pretty small.

First, many of the technologies covered in this book existed two years ago and will continue to be around two years from now. That means Java, which was introduced in 1995, HTML, the scripting techniques, and the basic Web page, which will continue to consist mainly of text and an occasional image. It’s hard to say if some new and incredibly different Web page development technique or tool will appear in the next two years, but regardless, people will also continue to use what is available now. In fact, the technologies introduced this year, such as Dynamic HTML and CSS1, will begin to become more familiar in 1998, and only begin to become mainstream technology in mid- to late 1998.

Web servers don’t seem to increase in technical capability exponentially the way Web page technology does. The real key to server technology is fast, reliable, and secure Web content access. The servers will become faster, hopefully more reliable, and the security should grow to meet the increasing demands placed on these servers to support commercial transactions. Additionally, there are new methods–particularly in the realm of commerce–that will work with existing server technology. Those are discussed in this chapter.

There are new technologies that have barely begun being explored this year. Channels and push technology started out with a bang and nearly ended with a whimper. Web consumers just didn’t buy into the new technology. However, with the built-in channel capability Netscape Navigator and Microsoft’s Internet Explorer have now, and with simpler channel development processes, channels can be considered down, but not out.

The real key to the future rests with standards as much as with implementation. The Document Object Model (DOM) working group of the W3C should present a first working draft of DOM by the end of 1997. DOM covers which HTML elements are exposed, and to an extent, in what way these same elements are exposed, what standard properties and events are, and how these elements relate to each other. If HTML doesn’t meet your needs, just wait–XML describes how to extend any markup language, to create an element such as <BUTCHER> or <BAKER> or, yes, even <CANDLESTICK_MAKER>. This chapter closes with a review of the new technologies currently under review and design.

The Chaos of Change

Sometimes you might feel you have to spend 24 hours a day just to keep up with the technology being released. Needless to say, this is both frustrating and discouraging, all at the same time.

Web development does seem, most of the time, as if it undergoes a revolution in technology every three months; many times one specific aspect of the technology undergoes a change only about once per year. However, preceding the release of the changed technology is a period when the technology is being reviewed, or the product is being beta-tested, or some form of pre-release activity is occurring. Then, the release of the standard or technology or product occurs, and there is a period of comparing it with its older version, or with other products. Then, you have to spend some time learning how the new technology works, how to migrate older pages or applications, or checking to see if existing pages or applications break with the new release. Finally, just when you think you are starting to become comfortable with the new or modified technology, the company or organization announces the new release of whatever the product or standard is.

Consider also that Web development is made up of several different technologies, including browsers, standards, embedded object technology, and server technology. Putting all of these aspects in one category–“Web Development”–and considering the multiple-phase delivery of most Web technology, provides what seems to be continuous change.

As an example, in 1997 it probably seemed as if a new browser were being released every quarter. Well, what actually happened is that there were minor bug fix releases of Netscape Navigator 3.x and Internet Explorer 3.x in the year’s beginning, and Netscape also released several different beta versions of Navigator 4.0 before it actually released Navigator 4.0. After the release, there have been several enhancement and bug fix releases of Navigator 4.0.

Microsoft also released two major beta releases of Internet Explorer and released the final version about the time this book went to editing. There will likely be enhancement and bug fix releases for IE 4.0 before the year is out.

Add the international releases with these other releases, and you have a browser release on the average of about every three weeks, not months.

Also consider that browser manufacturers themselves are at the mercy of the release of new standards or new versions of existing standards. The year 1997 saw the beginning of the DOM effort, a new version of the HTML specification, HTML 4.0, the rise in interest in XML, the passage of the ECMA standard for scripting, ECMAScript, and the recommendation of CSS1 for Web page presentation. And these are only some of the standards that impact browsers.

So, how do the browser manufacturers cope with the changing standards? The same way you can cope with all of the other changing technology: First, you define your Web development and Web client platforms. You determine what technologies make up each, including versions, and concentrate on these technologies, complete the effort you determine to complete with the defined platform, and then, and only then, begin to plan your next Web platforms.

The Current Technology Platform

For many companies and individual users, the current technology platform consists of Netscape Navigator 3.x or Internet Explorer 3.x for the browser, Apache 1.2, Netscape Enterprise Server 2.0 or 3.0, O’Reilly’s WebSite Pro, or Microsoft’s Internet Information Server 2.0 or 3.0.

Most Web pages contain a combination of text and images, and most of the images are static. Many sites use some form of scripting for page interaction, most likely a form of JavaScript. HTML tables are used to handle the layout of HTML elements, as shown in Figure 37.1.

As you can see from the figure, you can actually create a fairly organized page using HTML tables. The page also uses the font element to color the sidebar text white; the color attributes of the table header and contents are used to set the header to red and the contents to yellow.

Animation in a page occurs through the use of Java applets, animated GIFs, Netscape style plug-ins, or ActiveX controls.

The version of Java used with most applets is based on the first release of the JDK–JDK 1.0.

Server-side applications are used to create dynamic Web pages, to present database information, or to process information returned from the Web page reader.

A Summary Review of the Technologies Covered in the Book–Where Will They Be in a Year?

A good rule of thumb when working with content for multiple versions of a tool is to support the currently released product in addition to one previous release. Based on this, you can count on supporting pages that work with Netscape Navigator 3.x and 4.x, and Internet Explorer 3.x and 4.x. As both browser companies begin the rounds of creating version 5.0 of their respective products, the business world will be cautiously upgrading pages to work with the new 4.0 technologies, particularly CSS1, HTML 4.0, and Dynamic HTML. By the time they have made the move to 4.0 technology, the 5.0 release of the browsers should be close to hitting the street.

The browser companies themselves probably follow a similar reasoning in that they support a specific number of versions of a standard, such as HTML, before they begin to drop deprecated content from earlier releases of HTML.

Standards organizations rarely release more than one recommended version of a standard each year. Sometimes they might go longer than a year before a new release, rarely less than a year.

Based on this, the technology you read about in this book should be viable for two years after publication of the book, which takes the Web into the year 2000.

The following sections look at each of the discussed technologies, with an eye on where each is likely to be on the eve of 2000.

HTML 4.0, CSS1

To start with the basics, the foundation of Web publishing is HTML, and this technology was explored in the first part of the book. Additionally, the first part of the book also looked at Cascading Style Sheets (CSS1) and Dynamic HTML. Dynamic HTML’s future is covered in the next section.

As this book goes to press, HTML 4.0 is the version of HTML currently under draft review. This version provides for increased form and table support, deprecates several existing elements, and adds a few new element types and several new attributes, such as intrinsic events.

HTML 4.0 should become a recommended specification at the end of 1997. Currently, Microsoft has incorporated the HTML 4.0 draft specifications into the first release of IE 4.0, and Netscape has promised to adhere to the standard after it becomes a recommendation. Based on this, any changes to the HTML 4.0 draft will probably result in a minor revision release for IE 4.0. However, the HTML 4.0 changes for Netscape Navigator will probably be extensive enough for the company to incorporate these changes in the next release of Navigator, version 5.0. Following the Navigator 4.0 release schedule, you should begin to see the early beta releases of Navigator 5.0 in the spring of 1998.

No new activity is occurring with the CSS1 standard at this time, at least not in its impact on Web page presentation. Additional style sheet specifications are underway for speech synthesizers (ACSS, which is Aural Cascading Style Sheets), and a printing extension is underway for CSS, allowing for accurate page printing. This is in addition to the CSS-P, or Cascading Style Sheet Positioning.

At this time, tools that process, generate, or incorporate CSS1 in some form include HoTMetaL Pro 4.0 from SoftQuad (http://www.softquad.com), Microsoft’s FrontPage 98, Xanthus Internet Writer (http://www.xanthus.se/), Symposia Doc+ 3.0 from GRIF (http://www.grif.fr/prod/symposia/docplus.html), PageSpinner for the Mac (http://www.algonet.se/~optima/pagespinner.html), and others.

In the next year or two, Web pages will begin to incorporate CSS1 and HTML 4.0, though Netscape Navigator 3.x has a base of users wide enough to prevent most companies from using only CSS1 and HTML 4.0 to create Web pages. However, both of the major browser vendors have promised support of these standards, and many of the Web generation’s tools will integrate them into the new versions of their tools. As these new tools are appearing as beta releases now, they should all be released as products in 1998. By the year 1999, most companies that want to control the presentation of their Web pages should be using at least some form of CSS1, and begin the process of removing deprecated HTML elements from their pages.

You can keep up with the standards for HTML at http://www.w3.org/TR/WD-html40/. The standard for CSS1 can be found at http://www.w3.org/Style/.

Dynamic HTML and DOM

In 1997, with the release of version 4 of their browsers, both Netscape and Microsoft provided support for the first time for Dynamic HTML. Dynamic HTML is the dynamic modification and positioning of HTML elements after a Web page loads.

Dynamic HTML is a great concept and badly needed for Web development. With this new technology you can layer HTML elements, hide them, change their colors, their sizes, even change the elements’ contents. That’s the good news. The bad news is that Netscape and Microsoft have implemented different versions of Dynamic HTML–differences that are a little awkward to work with at best, and conflicting at worst.

Neither Netscape nor Microsoft has implemented broken versions of Dynamic HTML. When Netscape published Navigator 3.0 and exposed HTML images to scripting access, there was a great deal of discussion about Microsoft’s “broken” implementation of JavaScript 1.1, the version of JavaScript also published with Navigator 3.0. However, Internet Explorer 3.x was not broken, but the browser did not implement the same scripting object model as Navigator 3.x. Now, with IE 4.0 and Navigator 4.x, the scripting object models are even more disparate, making it difficult to create Dynamic HTML effects that work equally well with both browsers.

The solution to this problem could be found with the Document Object Model standardization effort currently underway with the W3C.

According to the W3C, the DOM defines an interface that exposes content, structure, and document style to processing, regardless of either the language used or the platform on which the DOM application resides. The functionality of Internet Explorer 3.0 and Netscape Navigator 3.0 is defined by the W3C to be level “zero” of the standard. You might assume it is that functionality that both of these browsers support, which means they would not include images.

At this time, the DOM working group has produced a requirements document, which includes items such as those in the following list:

  • All document content, elements, and element attributes are programmatically accessible and can be manipulated. This means that you can use script to alter the color of header text, or dynamically alter the margins of the document.
  • All document content can be queried, with built-in functions such as get first or get next.
  • Elements can be removed or added dynamically.
  • All elements can generate events, and user interactions can be trapped and handled within the event model.
  • Style sheets can be dynamically added or removed from a page, and style sheet rules can be added, deleted, or modified.

This list is just a sampling of the requirements for the DOM specification, but it is enough to see that when the DOM specification becomes a recommendation, the days of the static and unchanging Web page will soon be over.

To see more about DOM, check out the DOM working page at http://www.w3.org/ MarkUp/DOM/.

Client Scripting and CSS1 Positioning

Excluding the objects exposed to scripting access as members of each browser’s scripting object model, there aren’t that many differences between Netscape’s implementation of JavaScript and Microsoft’s implementation of JavaScript.

Scripting will continue to be used in the years to come, and, hopefully, the language will not get too complicated, or the ease of use of scripting languages will begin to diminish.

Again, the major impact on scripting occurs with the elements that become exposed by the DOM effort. However, this is not a guarantee that the same script block written for Netscape’s Navigator will work with Microsoft’s Internet Explorer.

Consider each browser’s implementation of dynamic CSS1 positioning. First, both companies support CSS1 positioning, a draft recommendation actually created by both companies. This standard provides style sheet attributes that control an element’s width, height, z-order (the element’s position in the stack if elements are layered), the location of the left side and top side of the element. The standard also provides an attribute to control the visibility of the object and the clipping area.

Figure 37.2 shows how well CSS1 positioning works by showing a Web page using this technology, opened in both IE 4.0 and Navigator 4.0. Note how the text aligns directly on top of the image (yes, the text and images are separate elements), and that the images are aligned in a vertical line along the left side of the page, without using an HTML table for layout control.

The example in Figure 37.2 is discussed in Chapter 8, “Advanced Layout and Positioning with Style Sheets,” and is located in the file images3.htm at this book’s Companion Web Site.

Using CSS1 positioning to control the layout of text and images.

If statically positioning elements using CSS1 positioning works equally well with both browsers, dynamic positioning does not. Both browsers create the same effects but use different techniques. Considering that standards usually define an effect or behavior but don’t necessarily define a specific technique, you probably won’t be seeing consistent scripting of HTML elements in the next couple of years.

Java

As this is being written, Sun is on the verge of releasing JDK 1.2, Netscape just created a minor release to cover most of the classes released with the JDK 1.1, and Microsoft also supports JDK 1.1 in its release of IE 4.0.

The use of JavaBeans–Java components that can be packaged, distributed, and used and reused in applications–is among the technologies supported with JDK 1.1. It’s a very good idea and one that has already achieved popularity among Java developers.

However, not all is positive in Java’s future, particularly when used with browsers. The browser companies are usually one version release behind the current Java class releases. That is not a problem. What is a problem is a situation that may make creating cross-browser applets virtually impossible.

The difficulties with the original release of Java had to do with the Advanced Windowing Toolkit or AWT classes. For the most part, interface development in Java was difficult and lacked sophistication. To resolve this, both Microsoft and Netscape began work with interface classes, called Application Framework Classes (AFC) by Microsoft and Interface Framework Classes (IFC) by Netscape.

Netscape joined Sun and combined Sun’s current efforts with its own IFC library to create the basis for the Java Framework Classes (JFC), due to be released with JDK 1.2. However, Microsoft had also spent considerable time with its own framework classes. At this time, the end result is Netscape and Sun supporting one set of classes and Microsoft supporting another.

To add to the problem, Sun also submitted Java to ISO (the International Standards Organization), to become a standardized language. They also asked to be designated a Publicly Available Submitter (PAS), or the group responsible for developing and maintaining the specification. At this time, the ISO working group, JTC 1, has voted against the Sun recommendation, with comments. Sun’s response, in effect, is that they will pull the language from ISO and treat it as a de jure standard, meaning that the company will retain control.

This is not a situation that is guaranteed to increase business confidence in the language. Add this to the difficulty of creating applets using any kind of framework, having the applet work with both IE and Navigator, and the increased sophistication of Dynamic HTML, and you may be in for a future decline of Java use for applets.

ActiveX

The new and exciting technology addition to ActiveX is DirectAnimation, DirectX technology extended for use with Java applets, controls, or scripting.

Being able to create ActiveX controls fairly easily using a variety of tools should lead to an increased popularity of these controls with companies whose intranets use Internet Explorer. The downside with the technology is that it is proprietary.

However, Microsoft also released several new filters that were originally ActiveX controls, but then were built in as style attributes. These controls can change the transparency of a Web page element, have a line of text become wavy, or add pinlights to a page. This technology is so fun and simple to use that the demand may likely be to add these to the DOM once it is released.

With this technology you can create rollover effects for menu images without the extra download of the rollover effect image.

CGI and Server-Side Applications

Server-side applicability is already at a point where most companies’ programming needs are met. CGI is still an effective server application technique and still works with most Web servers. If your company uses Internet Information Server, Active Server Pages is still a viable application option, just as LiveWire is for Netscape’s Enterprise Server.

One change you may see more of is the use of CORBA/COM technology and distributed processing, with Web servers acting as one hub within a distributed network. Browsers might become “interface containers” rather than Web page processing tools. With the increased sophistication of Dynamic HTML, it won’t be long before you might be creating a Web page as the front end for a company application, in addition to using tools such as Visual Basic or PowerBuilder.

VRML

VRML is a wonderful idea that’s still looking for that killer application to take it out of the artist’s realm and plunk it directly into business.

Consider VRML’s concept, which is that you send a simple text file to a VRML-capable reader, which then renders the text contents into incredible, interactive 3D “worlds.” This is Internet technology at its best, as you have seen already with HTML, and will probably see with XML.

With VRML 2.0, the living world specification and the capability to integrate Web page scripting and VRML worlds, you are going to see more of this technology in use, for store catalogs, Web site maps, educational tools, and yes, even to play games and have a little fun.

XML and Channels

Neither XML nor channel technology, which are related, has found a niche yet, but with the release of CDF technology from Microsoft and Netcaster from Netscape, this should change.

The concept of push technology started with a bang at PointCast’s release, and almost disappeared without even a whimper–a case of too much hype and not enough efficient technology. In addition, the channel content just wasn’t there.

The entry of Netscape and Microsoft into the channel technology can only boost the use of this technology. Already, there is an increased number of companies providing channels. Add in those companies that are using the Marimba Castanet technology, and you should see an increased number of channels from diverse Web sites in the next year.

XML is the Extended Markup Language standard that basically adds the concept of extending Web page HTML to include new objects–objects related to the company’s business, based on some topic, or even packaged for reuse.

Microsoft and Marimba have proposed the use of CDF (Channel Definition Format) with the use of XML for use with channel technology. Apple has used a precursor of XML to create 3D Web site maps that are generated automatically; your reader can traverse to determine which page to access.

You can read more about XML at the W3C site at http://www.w3.org/XML/You can read more about Microsoft and Netscape’s implementation at their respective sites or in Chapter 34, “XML.”

Summary

Where will you be in the future of Web development? Not all that far from where you are now. New technologies seem as if they are popping up all the time–but they need time to get absorbed into the mainstream of Web sites.

One technique to begin incorporating the new technologies is to create a special set of pages for your Web site–not your main pages, but those that can demonstrate a product or idea and use the new technologies. A set of pages for the Web site shown in Figures 37.3, Figure 37.4, and Figure 37.5 are viewable only by Netscape Navigator 4.0 and Internet Explorer 4.0; these are additional pages to a Web site, but the sites themselves use mostly mainstream technology, meaning some use of CSS1, scripting, some CSS1 positioning, HTML tables, and just plain text.

The Web pages use Dynamic HTML to hide and display content, as well as hide and display the menu. The page also uses CSS1 positioning to lay out the HTML elements.

The technologies discussed in this book are effective today, and will be effective into the year 2000. Best of all, they won’t break on New Year’s Day, 2000.

Categories
Web Writing

Books at Amazon

Recovered from the Wayback Machine.

Dynamic HTML Power Guide authored by Shelley Powers, published in January, 1998. 1/19/98 – Finally, at long last, this book is in the bookstores!“Dynamic HTML” book provides over 100 examples covering both Microsoft Internet Explorer 4.0 and Netscape Navigator 4.0 Dynamic HTML. This includes an explanation and demonstration of the style specification standard CSS1, and provides an overview of both VBScript and JavaScript 1.2, to assist in understanding examples written with both scripting languages. The book also has separate sections providing comprehensive coverage and demonstrations of the IE 4.0 and Navigator 4.0 scripting object models.

The end of the book features a section containing complex cross-browser examples such as an online presentation, magazine, game, and catalog page.

What cross-browser techniques will you learn? How to layer content, use layers and DIV blocks together, hide and show content, two different techniques for drag and drop, event capturing, clipping, element movement, and yes, even how to replace content in a page AFTER the page has been loaded. This is in addition to how to maintain DHTML “state”, and how to create cross-browser scripting objects that take care of browser differences.

The book also has fun with each individual browser. Using forms and layers together. Hiding and showing form “hints”. Learn how to emulate the IE shadow and alpha visual filters in Navigator. Play with drag and drop art. Have some fun with Microsoft’s visual and transition filters. Hide and show content, or change the style attribute for content.

The book has been tested against the delivered IE 4.0 product, and Navigator 4.4, on Windows95 and NT.

Book is for an intermediate/advanced audience.

Dynamic Web Publishing Unleashed co-authored by Shelley Powers, published in December, 1997 by SAMS.Book is an overview of Web-based technologies including HTML 4.0, DHTML, CSS1, Scripting, Java 1.1, Channels, server-side techniques and more. If you are new to Web, or have only worked with one or two Web technologies this book can help you “catch up” with the seemingly endless components of Web development. The book follows more of a reference format, meaning that each section can be read in any order. The book also follows the philosophy of “less talk, more code”.

The Channels and VRML chapters, and my commentary chapter on the future of the Web technologies, are online at SAMS at http://www.mcp.com/sites/1-57521/1-57521-363-x/.

Note that there is some confusion at various online bookstores about the size of the book. It is a little over 800 pages in length, not including the online chapters. Also note that this book is not by the same author as Web Publishing Unleashed, follows a different format, and contains new content.

Perl from the Ground Up, by Osborne McGraw-Hill, due to be published in 1997.I wrote the chapters on Object-Oriented Perl, and Perl and the Internet-based libraries. The book promises to be a good overall discussion of Perl that does not require any previous Perl experience.
Java Unleashed 1.1 – published by SAMS, 1997.I wrote the chapters on the SQL classes, and Java Databases. This book provides a good, overall, coverage of the JDK 1.1, including coverage of RMI, JDBC, threads, JAR, networking, sockets, applets, and much more.
Maximum Java 1.1 – published by SAMS, 1997.I wrote the chapters on Managing Media, Finding and Using Resources, and the Java Commerce API. This is a book that covers advanced Java topics such as the Java and VRML 2.0, Reflection and Introspection, factory objects, serialization and persistence and other. This book takes off from where others end.
PowerBuilder 5 How To, co-authored by Shelley Powers, published in 1996 by Waite Group Press.Book is fairly large and answers some of the most common PB 5.0 questions, using the Waite Group Press “Question and Answer” format popular with the “How To” series. In addition, this was the first book on the shelves that provided examples for using the DataWindow plug-ins.

I am particularly proud of the section I wrote on creating the different types of applications, demonstrating that PB applications do not need to be MDI (multiple document interface) apps, only.

Using Perl 5 for Web Programming, co-authored by Shelley Powers, published by Que, 1996.This is an Amazon Bookstore bestseller. I particularly like the company newsletter example I created for this book.