Sunday, October 30, 2005

Blogger Templates

Do you use Blogger a lot? Then you will surely have sometime or the other changed
the template. I did. And it set me thinking, what are these <$Blogger$>
symbols. How are these templates designed?

If you want to read to design a template read on. You will probably need to understand
how HTML works. Some CSS might be useful too. But apart from that nothing else
is needed.

The Blogger templates are based on CSS and HTML. Any valid HTML/CSS construct
can be used. But then Blogger adds some more extensions. These are the Blogger
tags. So any non HTML tags you see in a template, it’s a Blogger tag.

Why do we need Blogger tags? A template is nothing but a, well template. It must
show different data depending upon the blog, author and a million other things.
Say I want to show the name of the blog in the title bar. Now there is obviously
no HTML tag for it. So what should I show. Will “I hate aliens” caption
be ok? But fret not, Blogger tags to rescue. <$BlogTitle$> does it.

Now some of the Blogger tags will have the $ sign in front and at end like <$BlogTitle$>.
These are the variables. They take different values depending upon the blog, post
etc. The tags without the $ sign allow formatting. But more about them later.
Oh one more thing, the Blogger tags case sensitive, unlike the HTML tags.

With all this information behind us let us try to make the simplest template possible.
It just shows the various posts without any formatting and any hyperlink.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title><$BlogTitle$></title>

</head>

<body>

<Blogger>

<$BlogItemBody$>

</Blogger>

</body>

</html>


When I apply this template, this is what my blog looks like.


We used three Blogger tags- <$BlogTitle$>, <Blogger>, <$BlogItemBody$>.
The <$BlogTitle$> tag was used to get the name of the Blog in the title
bar. Then we used the <Blogger> tag. Did you notice it had no $ sign.
It is repeating kind tag. Anything between this tag repeats for all entries.
So as we wanted to show all our posts, we included the <$BlogItemBody$>
between Blogger tags. Also as you might have guessed the <$BlogItemBody$>
gives us the posts of the blog. We need to close the opening <Blogger>
tag with a closing </Blogger> tag. Any Blogger tag without the $ sign
must be closed. But the tags with $ sign are not closed.

By the way this template sucks, doesn’t id. Like you wrote the blog, and
it does not even acknowledge the wri

Blogger Templates

Do you use Blogger a lot? Then you will surely have sometime or the other changed
the template. I did. And it set me thinking, what are these <$Blogger$>
symbols. How are these templates designed?

If you want to read to design a template read on. You will probably need to understand
how HTML works. Some CSS might be useful too. But apart from that nothing else
is needed.

The Blogger templates are based on CSS and HTML. Any valid HTML/CSS construct
can be used. But then Blogger adds some more extensions. These are the Blogger
tags. So any non HTML tags you see in a template, it’s a Blogger tag.

Why do we need Blogger tags? A template is nothing but a, well template. It must
show different data depending upon the blog, author and a million other things.
Say I want to show the name of the blog in the title bar. Now there is obviously
no HTML tag for it. So what should I show. Will “I hate aliens” caption
be ok? But fret not, Blogger tags to rescue. <$BlogTitle$> does it.

Now some of the Blogger tags will have the $ sign in front and at end like <$BlogTitle$>.
These are the variables. They take different values depending upon the blog, post
etc. The tags without the $ sign allow formatting. But more about them later.
Oh one more thing, the Blogger tags case sensitive, unlike the HTML tags.

With all this information behind us let us try to make the simplest template possible.
It just shows the various posts without any formatting and any hyperlink.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title><$BlogTitle$></title>

</head>

<body>

<Blogger>

<$BlogItemBody$>

</Blogger>

</body>

</html>


When I apply this template, this is what my blog looks like.



We used three Blogger tags- <$BlogTitle$>, <Blogger>, <$BlogItemBody$>.
The <$BlogTitle$> tag was used to get the name of the Blog in the title
bar. Then we used the <Blogger> tag. Did you notice it had no $ sign.
It is repeating kind tag. Anything between this tag repeats for all entries.
So as we wanted to show all our posts, we included the <$BlogItemBody$>
between Blogger tags. Also as you might have guessed the <$BlogItemBody$>
gives us the posts of the blog. We need to close the opening <Blogger>
tag with a closing </Blogger> tag. Any Blogger tag without the $ sign
must be closed. But the tags with $ sign are not closed.

By the way this template sucks, doesn’t id. Like you wrote the blog, and
it does not even acknowledge the writer. And by the way when did you write it.
An hour ago or a million years ago. So now let’s add the name of the author
and the time to the blog. And while you are at it, make a navigation structure
to move through the blog.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title><$BlogTitle$></title>

</head>

<body>

<Blogger>

<br>

<br>

<$BlogItemBody$>

Posted by <$BlogItemAuthorNickname$> on <$BlogItemDateTime$>

<a href="<$BlogItemPermalinkURL$>">permanent link</a>

<br>

<ItemPage>

<a href="<$BlogUrl$>">Back to index</a>

</ItemPage>

</Blogger>

</body>

</html>


As you can see now the name and time are visible along with a link to the post
pages.


Let’s see the new tags we have used. We want to write the name of the
post author and the time post was created. We can do it using <$BlogItemAuthorNickname$>
<$BlogItemDateTime$> tags. But then we want a link to individual posts.
<$BlogItemPermalinkURL$> provides the address where current blog resides.
But then when the user visits one of the post pages he needs a link to the index
page. But we do not want a link if we are already on the index page. So we put
a link using <a href="<$BlogUrl$>">Back to index</a>,
but enclose it within a <ItemPage> tag. Anything within the <ItemPage>
tag will only print if the current page is a individual post page. So our link
will be visible only on the post pages.

Next we need to allow the people viewing our blog to post comments. And what
is the permanent link doing on a post page. Let’s see our next template.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title><$BlogTitle$></title>

</head>


<body>>

<Blogger>

<br>

<br>

<$BlogItemBody$>

Posted by <$BlogItemAuthorNickname$> on <$BlogItemDateTime$>

<MainPage>

<a href="<$BlogItemPermalinkURL$>">permanent link</a>

</MainPage>

<BlogItemCommentsEnabled>

<a href="<$BlogItemCommentCreate$>"

<$BlogItemCommentFormOnClick$>>

<$BlogItemCommentCount$> comments</a>

</BlogItemCommentsEnabled>

<br>

<ItemPage>

<BlogItemCommentsEnabled>


<a name="comments"></a>




<h4><$BlogItemCommentCount$> Comments:</h4>




<BlogItemComments>

<a name="<$BlogCommentNumber$>"></a>


<p>

<$BlogCommentBody$>

</p>


<p>

By <$BlogCommentAuthor$>, at

<a href="#<$BlogCommentNumber$>">

<$BlogCommentDateTime$></a>

<$BlogCommentDeleteIcon$>

</p>


</BlogItemComments>


<p><a href="<$BlogItemCommentCreate$>"


<$BlogItemCommentFormOnClick$>>

Post a Comment</a></p>


</BlogItemCommentsEnabled>

<a href="<$BlogUrl$>">Back to index</a>

</ItemPage>

</Blogger>

</body>

</html>


This is what our blog looks now.


And our post pages will also show the comments.

We have enclosed the <a href="<$BlogItemPermalinkURL$>">permanent
link</a>

tag in a <MainPage> tag so that the permanent link is not visible on post
pages. We need to allow users to make comments only if comments are enabled.
So we use the conditional tag <BlogItemCommentsEnabled>. <BlogItemComments>
is a tag similar to <Blogger> tag in the sense that is will repeat anything
between it for all the comments. All other tags have fairly descriptive names.



Saturday, October 29, 2005

Eclipse

Introduction:

Eclipse is an integrated development environment for “everything and nothing in particular”. Plugins exist for every thing including Java, C++, Cobol and others.

Eclipse was first licensed by IBM and then donated to the open source community. IBM and group of other companies are backing Eclipse. With open source community Eclipse has grown from strength to strength.

But eclipse has strong support for Java. The plug-in for Java comes out of the box with Eclipse. If you are looking for an IDE to develop Java desktop applications, look no further.

Comparison with other IDEs:

If you are developing serious Java apps, you will need a good IDE. The market for Java IDEs is taken by four players, Eclipse, Netbeans, JCreator, and IDEA.

Of these Eclipse and Netbeans are free. JCreator has a free non-expiring version but with some features disabled. So if you are not looking to spend some money, Eclipse is your best bet. It has almost all the functions found in commercial IDEs. It is considerably faster than Netbeans.

Installing Eclipse:

To install eclipse you will need

  1. JRE 1.4 or higher
  2. Eclipse zip
  3. A utility to unzip the zip file.

Unlike some other utilities Eclipse does not come with a installer. You just need to unzip it to a directory and it will start to work.

Common problems:

  1. Java runtime environment not found.

Solution: Get JRE from the sun site. Install it before you run Eclipse. Eclipse does not contain a JRE.

Your first program:

Here we will develop the HelloWorld program using eclipse. When you start eclipse you will get a screen similar to this.

Since we need to write a Java program change to Java perspective by, Window>Perspective>Open perspective>Java.

Image hosted by Photobucket.com

If you cannot see option for Java in open perspective choose other and then choose Java.

Every program must have a project associated with it. So we will create a new project using, File>New>Project.

Image hosted by Photobucket.com

Lets name it HelloProject.

Next we need to create a new class. This can be done by File>New>Class.

Image hosted by Photobucket.com

After giving it a suitable name( HelloWorld?) write your program. Now save it by pressing Ctrl+s. there is no need to compile as Eclipse automatically compiles.

It can be executed by Run>Run as>Java application


Image hosted by Photobucket.com

That’s it. Your program is compiled and running. To see the output change to console tab at the bottom.

Image hosted by Photobucket.com

This was the basic of eclipse IDE.