Programing

XHTML/CSS over table

One of the large benefits of using XHTML/CSS over table based or inline page styling is the semantic and download time values that it brings. However, many people still have plenty of unnecessary mark-up in their code with extra div elements and unneeded classes, etc.

I am going to show a few quick examples on how you can lean up your mark-up and reach XHTML nirvana (ok, very few people will actually obtain bliss from this - and those that do scare me).

The first example I often see is through the use of stying the header of a page. It is not uncommon to see code such as this:

<div id=”header”>
<h1 id=”sitename”>MySuperSite.com</h1>
<h2 id=”sitetag”>All the superness that can be sited, ever</h2>
</div>

Hopefully most of you can see the unnecessary code here. While you can assign id’s to both the H1 and H2 headings to style them differently than headings that don’t appear in the header div - you can also cut down on your markup by simply specifying all headings with in the header div.

For example:

CSS:
#header h1 { font-size: 200%; color: #555555; }
#header h2 { font-size: 150%; color: #AAAAAA; }

XHTML:
<div id=”header”>
<h1>MySuperSite.com</h1>
<h2>All the superness that can be sited, ever</h2>
</div>

While this does add more mark-up to the CSS (which then takes longer to download) the markup is still less, and you don’t end up re-downloading the same mark-up page after page.

Register to read more...

XHTML code correctly

Marking up your XHTML code correctly

Within this document, references will be made to elements and attributes. It's important to understand the difference, so consider this sample code:

<a href="index.html" title="Environmental Protection Agency home page">Home</a>

The base HTML element is the link anchor (a). The attribute is any additional information about that element within the initial <> pair, such as the href and title values in this case.

Register to read more...

Multi Dimensional Programming

Before we get into the details of Multi-Dimensional programming, let us take a look at the conventional styles, and one of the most popular languages: C. C lacks variables. There are no variables in C. C, in essence, is a very thin wrapper over assembly, and was primarily created for the purpose writing operating systems. What does it mean by the statement C lacks variable, and what does it entail as far as a developer is concerned?

C source code is compiled via first converting to assembly, and thus all the variable information that you have used in your code is completely lost when it is converted to assembly, and all your logic is translated to pure memory manipulation, and this is one of the reasons why writing in C is a pain. The lack of variables in the run time code leads to the classic problem, something because of which programming lost much of its charm in the early days in my college when I first tried to code in C. The problem is this: Let us say, you have a program that takes input from a person, and wants to store it in variables. The user is going to provide both the variable name and the value, and you want to automatically store the values in the user supplied variable names, both of which your user supplied. The psuedocode of that in would look like this:

—————
while (true) {
print(”Input Variable Name:”);
read(variable-name);
print(”Input Variable Value:”);
read(variable-value);
this.*(variable-name) = variable-value;
}
—————-

The idea here is to allow the user to dynamically specify the variable names on top of providing values, and this is something that’s impossible with C or any static language. We will define multi-dimension programming as: treating all language variables as further variables. Coding in this manner can reduce the total number of lines by 1/10th, and in the case of web programming, you can completely avoid the tedium of manually creating html layout for every page.

Page 1 of 4