<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Walt's Scratch Pad</title>
	
	<link>http://www.waltscratchpad.com</link>
	<description>Thinking about Computer Science, Software Engineering, Open Source, UML, Java and everything I have in my mind.....</description>
	<pubDate>Fri, 09 Oct 2009 14:27:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WaltsScratchPad" /><feedburner:info uri="waltsscratchpad" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>A StringTokenizer Function in PL/SQL</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/SHtcmmcC8Jw/</link>
		<comments>http://www.waltscratchpad.com/database/a-stringtokenizer-function-in-plsql/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 14:27:30 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[function]]></category>

		<category><![CDATA[oracle]]></category>

		<category><![CDATA[pl/sql]]></category>

		<category><![CDATA[REGEXP_INSTR]]></category>

		<category><![CDATA[REGEXP_SUBSTR]]></category>

		<category><![CDATA[StringTokenizer]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=369</guid>
		<description><![CDATA[In this post, I will show two simple ways to create a StringTokenizer function in PL/SQL. One way is to use regular expressions using the functions REGEXP_SUBSTR  and REGEXP_INSTR  provided by Oracle. The Functions REGEXP_SUBSTR and REGEXP_INSTR are merely an extension of their function INSTR and SUBSTR in Oracle. The STRINGTOKENIZER_REGEX function, which [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/DktCNv6fNkHjfYHrcXX6t2oCpxw/0/da"><img src="http://feedads.g.doubleclick.net/~a/DktCNv6fNkHjfYHrcXX6t2oCpxw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/DktCNv6fNkHjfYHrcXX6t2oCpxw/1/da"><img src="http://feedads.g.doubleclick.net/~a/DktCNv6fNkHjfYHrcXX6t2oCpxw/1/di" border="0" ismap="true"></img></a></p><p>In this post, I will show two simple ways to create a <strong>StringTokenizer</strong> function in PL/SQL. One way is to use regular expressions using the functions <strong><a href="http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/functions116.htm">REGEXP_SUBSTR</a></strong>  and <strong><a href="http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/functions114.htm">REGEXP_INSTR</a></strong>  provided by <strong><a href="http://www.oracle.com">Oracle</a></strong>. The Functions REGEXP_SUBSTR and REGEXP_INSTR are merely an extension of their function INSTR and SUBSTR in Oracle. The <strong>STRINGTOKENIZER_REGEX</strong> function, which you can see below, it behaves like the class <strong><a href="http://java.sun.com/javase/6/docs/api/java/util/StringTokenizer.html">StringTokenizer</a></strong> in <strong>Java</strong>, that&#8217;s by removing all the tokens that are NULL. The result will be a DBMS_SQL.varchar2_table with all valid tokens. Let&#8217;s see, now, the code:</p>
<p> <span id="more-369"></span></p>
<p>
<pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: true; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">
CREATE OR REPLACE
FUNCTION STRINGTOKENIZER_REGEX
    (p_string IN LONG, p_separators IN VARCHAR2)
RETURN DBMS_SQL.varchar2_table
IS
    l_token_tbl DBMS_SQL.varchar2_table;
    pattern     VARCHAR2(250);
    param_clob  CLOB;
BEGIN
    param_clob := TO_CLOB(p_string);
    pattern := '[^(' || p_separators || ')]+' ;
        SELECT   REGEXP_SUBSTR (param_clob, pattern, 1, LEVEL) token
          BULK   COLLECT
          INTO   l_token_tbl
          FROM   DUAL
         WHERE   REGEXP_SUBSTR (param_clob, pattern, 1, LEVEL) IS NOT NULL
    CONNECT BY   REGEXP_INSTR (param_clob, pattern, 1, LEVEL) &gt; 0;
    RETURN l_token_tbl;
EXCEPTION
    WHEN OTHERS THEN
        dbms_output.put_line('STRINGTOKENIZER_REGEX - Error '||TO_CHAR(SQLCODE)||': '||SQLERRM);
        dbms_output.put_line(DBMS_UTILITY.format_error_backtrace);
        RAISE;
END STRINGTOKENIZER_REGEX;
/</pre>
</p>
<p>You can do the same thing, given above, without using <em>regular expressions</em>. In fact, you can use directly <strong>INSTR</strong> and <strong>SUBSTR</strong> functions of Oracle. In this case, the <em>PL/SQL <strong>STRINGTOKENIZER</strong> function</em>, see below, always returns a DBMS_SQL.varchar2_table but with also the tokens equals to NULL. See the code below:</p>
<p>
<pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: true; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">
CREATE OR REPLACE
FUNCTION STRINGTOKENIZER
    (p_string IN LONG, p_separators IN VARCHAR2)
RETURN DBMS_SQL.varchar2_table
IS
    l_token_tbl DBMS_SQL.varchar2_table;
    l_start NUMBER;
    l_pos NUMBER;
    l_index NUMBER;
BEGIN
    l_start := 1;
    l_pos :=1;
    l_index:=1;
    WHILE TRUE LOOP
        l_pos := INSTR (p_string ,p_separators ,l_start);
        IF l_start &gt; LENGTH(p_string) THEN
        EXIT;
        END IF;
        IF l_pos = 0 THEN
        l_token_tbl(l_index):=Substr(p_string ,l_start, LENGTH(p_string)+1-l_start);
        EXIT;
        END IF;
        l_token_tbl(l_index):=Substr(p_string ,l_start, l_pos-l_start);
        l_start:=l_pos+LENGTH(p_separators);
        l_index:=l_index+1;
    END LOOP;
    RETURN l_token_tbl;
EXCEPTION
    WHEN OTHERS THEN
        dbms_output.put_line('STRINGTOKENIZER - Error '||TO_CHAR(SQLCODE)||': '||SQLERRM);
        dbms_output.put_line(DBMS_UTILITY.format_error_backtrace);
        RAISE;
END STRINGTOKENIZER;
/</pre>
</p>
<p>Now we write a PL/SQL script to test our function: </p>
<p>
<pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: true; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">
DECLARE
ret DBMS_SQL.VARCHAR2_TABLE;
BEGIN
-- Now call the stored program
  ret := STRINGTOKENIZER('aaa|bbb|ccc|ddd|eeee|','|');
-- Output the results
IF ret IS NOT NULL THEN
 IF ret.count &gt; 0 THEN
   FOR i IN ret.first..ret.last LOOP
     IF ret.exists(i) THEN
       null; -- type of data not known
dbms_output.put_line(SubStr('ret('||TO_CHAR(i)||') = '||ret(i),1,255));
      END IF;
    END LOOP;
  END IF;
 END IF;
EXCEPTION
WHEN OTHERS THEN
  dbms_output.put_line(SubStr('Error '||TO_CHAR(SQLCODE)||': '||SQLERRM, 1, 255));
  dbms_output.put_line(dbms_utility.format_error_backtrace);
RAISE;
END;
</pre>
</p>
<p>The above code tests only the function <strong>STRINGTOKENIZER</strong>, but it&#8217;s easy to modify. Finally, both functions seem to work perfectly. The only difference, as already described, is regarding the output of token NULL. However, there is  another difference, that is on performance. In fact, the use of regular expressions functions on very long strings is slower than using directly strings function.</p>
<p><div style="text-align:center;"><script type="text/javascript"><!--
google_ad_client = "pub-5270551448254756";
google_ad_slot = "0671009180";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/SHtcmmcC8Jw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/database/a-stringtokenizer-function-in-plsql/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/database/a-stringtokenizer-function-in-plsql/</feedburner:origLink></item>
		<item>
		<title>Improve your Blog - 4 - Post Length &amp; Frequency are Important?</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/SvPBFq2ehr4/</link>
		<comments>http://www.waltscratchpad.com/tipstricks/improve-your-blog-4-post-length-frequency-are-importan/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 10:59:57 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[tips&tricks]]></category>

		<category><![CDATA[blog]]></category>

		<category><![CDATA[Idea]]></category>

		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=359</guid>
		<description><![CDATA[The hardest thing to do for a blogger is to update as often as possible their blog. Very often the passion for the topics  could not be enough, because you have to spend all time for the  commitments and contingencies of life so you don&#8217;t have more time to dedicate to your blog.

Most [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/Nz3jfkUvugmA6em3pCBGW2o9yNI/0/da"><img src="http://feedads.g.doubleclick.net/~a/Nz3jfkUvugmA6em3pCBGW2o9yNI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Nz3jfkUvugmA6em3pCBGW2o9yNI/1/da"><img src="http://feedads.g.doubleclick.net/~a/Nz3jfkUvugmA6em3pCBGW2o9yNI/1/di" border="0" ismap="true"></img></a></p><p><div style="float:left;padding-right:10px;"><iframe src="http://rcm.amazon.com/e/cm?t=soswebdes04-20&o=1&p=8&l=ez&f=ifr&f=ifr" width="120" height="240" scrolling="no" marginwidth="0" marginheight="0" border="0" frameborder="0" style="border:none;"></iframe></div><em>The hardest thing to do for a <strong>blogger</strong> is to update as often as possible their <strong>blog</strong>. </em>Very often the passion for the topics  could not be enough, because you have to spend all time for the  commitments and contingencies of life so you don&#8217;t have more time to dedicate to your blog.<br />
<span id="more-359"></span><br />
<em>Most people think that the ideal frequency to publish a post is daily. </em>is that true?    Is it necessary, therefore, to write as many posts as possible in the shortest possible time?</p>
<p>It&#8217;s certainly true that a <em><strong>not updated blog</strong> will never be a successful blog and perhaps will be a dead blog.</em> In any case, <em>the content unique is most important thing.</em> That&#8217;s really the target blogger. <em>Quantity is nothing without quality. </em></p>
<p>Another factor is how long must be a post.  <em>I don&#8217;t think length is a very important factor for a blog.</em> In fact, it can be very variable and it is certainly related to the topic you want to treat. For example, a &#8220;tips &amp; tricks&#8221; or a &#8220;How To&#8221; could be very short, on the contrary a tutorial, for example, speaking about a programming language, could be very long.</p>
<p>Searching on the Internet with <a title="Post Length &amp; Frequency" href="http://www.google.com/cse?cx=partner-pub-5270551448254756%3Aol2eo8-ckoh&amp;ie=ISO-8859-1&amp;q=Post+Length+%26+Frequency&amp;sa=Search" target="_blank">google</a> you can find very different <a title="Post Length &amp; Frequency" href="http://www.google.com/cse?cx=partner-pub-5270551448254756%3Aol2eo8-ckoh&amp;ie=ISO-8859-1&amp;q=Post+Length+%26+Frequency&amp;sa=Search" target="_blank">answer</a> to these questions.  <a title="Creating Content – Post Length &amp; Post Frequency" href="http://www.johnchow.com/creating-content-post-length-post-frequency/" target="_blank">Here</a> you can find a John Chow post about this topic.  You can read a different view of the Eric Kintz <a title="Why Blog Post Frequency Does Not Matter Anymore" href="http://www.mpdailyfix.com/2006/06/w_why_blog_post_frequency_does.html" target="_blank">here</a>.  Are there some ideas in common?  That remains is to experiment and form your own opinion.  <img src='http://www.waltscratchpad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>My personal idea is that <em><strong>L</strong><strong>ength</strong> and <strong>Frequency</strong> are two secondary factors closely related to the <strong>Content</strong></em>. Bloggers that deal with more complex issues, like this blog, will have more difficulty in maintaining a constant frequency, but this should not be discouraged if you have the ability to write interesting content.  Personally I&#8217;ve chose to publish no more than one post per week. To make life easier, I decided to write not only complex post, such as Java or computer science topics, but also simpler and shorter post where I express my point of view. I thought then to design this series of posts about the steps that I am following to improve my blog and make it successful.</p>
<p>Obviously I don&#8217;t know if this way is the right choice and if this blog will never become a successful blog like <a title="John Chow" href="http://www.johnchow.com/" target="_blank">John Chow</a>, but in any case the most important thing is fun <img src='http://www.waltscratchpad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Good luck to me and to you all <img src='http://www.waltscratchpad.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><p style="text-align:center"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_9918db48-38d9-4842-8722-b3540b5b2b8c"  WIDTH="468px" HEIGHT="60px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fsoswebdes04-20%2F8009%2F9918db48-38d9-4842-8722-b3540b5b2b8c&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fsoswebdes04-20%2F8009%2F9918db48-38d9-4842-8722-b3540b5b2b8c&Operation=GetDisplayTemplate" id="Player_9918db48-38d9-4842-8722-b3540b5b2b8c" quality="high" bgcolor="#ffffff" name="Player_9918db48-38d9-4842-8722-b3540b5b2b8c" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="60px" width="468px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fsoswebdes04-20%2F8009%2F9918db48-38d9-4842-8722-b3540b5b2b8c&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT></p></p>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/SvPBFq2ehr4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/tipstricks/improve-your-blog-4-post-length-frequency-are-importan/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/tipstricks/improve-your-blog-4-post-length-frequency-are-importan/</feedburner:origLink></item>
		<item>
		<title>Improve your Blog - 3 - Choosing the Content to Write</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/IBojvoUX3qA/</link>
		<comments>http://www.waltscratchpad.com/tipstricks/improve-your-blog-3-choosing-the-content-to-write/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 11:27:12 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[tips&tricks]]></category>

		<category><![CDATA[blog]]></category>

		<category><![CDATA[content]]></category>

		<category><![CDATA[topic]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=346</guid>
		<description><![CDATA[The most important thing for a Blog is its content. It&#8217;s necessary to understand what you want to write if  you want to become a good blogger.  I think the first thing is that you must only write about topics that you&#8217;re passionate. It makes no sense to choose topics that are cutting-edge [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/K4bJat67UpK3Fb-D-EAGe-zs0w4/0/da"><img src="http://feedads.g.doubleclick.net/~a/K4bJat67UpK3Fb-D-EAGe-zs0w4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/K4bJat67UpK3Fb-D-EAGe-zs0w4/1/da"><img src="http://feedads.g.doubleclick.net/~a/K4bJat67UpK3Fb-D-EAGe-zs0w4/1/di" border="0" ismap="true"></img></a></p><p><div style="float:left;padding-right:10px;"><iframe src="http://rcm.amazon.com/e/cm?t=soswebdes04-20&o=1&p=8&l=ez&f=ifr&f=ifr" width="120" height="240" scrolling="no" marginwidth="0" marginheight="0" border="0" frameborder="0" style="border:none;"></iframe></div><em><strong>The most important thing for a Blog is its content.</strong></em> It&#8217;s necessary to understand what you want to write if  you want to become a good blogger.  I think the first thing is that <em><strong>you must only write about topics that you&#8217;re passionate.</strong></em> <span id="more-346"></span>It makes no sense to choose topics that are cutting-edge but not of your interest.  Obviously there are topics they talk about all and other less common,  but don&#8217;t worry about that because the <strong>blog visibility</strong> depend on not only how much you write but also what you write and especially how you write. It&#8217;s certainly better write about topics <span onclick="dr4sdgryt(event)">well-known a little but </span>that you know well, rather than about topics that everyone <span onclick="dr4sdgryt(event)">take an interest in but you&#8217;re </span> not able to add anything new.
<p>Another consideration that can be done is that <em>the post content should not be too generic</em>, so it&#8217;s possilbe that your readers are only a few friends and family. Maybe it&#8217;s better and simple to send emails to interested people. <em> When you write a post you must always remember that you write because someone read it.</em><em></em> <em>A post must contain information and/or personal views that may be of interest to someone. </em></p>
<p>It must also decide whether the blog you want to create should be with only a topic or more. <em>Personally I prefer blogs with more arguments</em>, but pay attention  because if there are too many topics the blog might not be properly classified by the search engines on the internet like Google and so you can receive visit from users that are not really interested in reading what we wrote. <strong>Must therefore be a master argument that predominates over the others.</strong></p>
<p>Now you have  just choose what write.</p>
<p>good luck&#8230;.</p>
<p><br/>
<p><div style="text-align:center;"><script type="text/javascript"><!--
google_ad_client = "pub-5270551448254756";
google_ad_slot = "0671009180";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/IBojvoUX3qA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/tipstricks/improve-your-blog-3-choosing-the-content-to-write/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/tipstricks/improve-your-blog-3-choosing-the-content-to-write/</feedburner:origLink></item>
		<item>
		<title>Object Oriented Concepts: Encapsulation</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/giIVe11JKKY/</link>
		<comments>http://www.waltscratchpad.com/java/object-oriented-concepts-encapsulation/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 10:36:07 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[Object Oriented]]></category>

		<category><![CDATA[encapsulation]]></category>

		<category><![CDATA[Exam CX-310-065]]></category>

		<category><![CDATA[java certification]]></category>

		<category><![CDATA[java objectives]]></category>

		<category><![CDATA[Object Oriented Concepts]]></category>

		<category><![CDATA[Objective 5.1]]></category>

		<category><![CDATA[OO]]></category>

		<category><![CDATA[scjp]]></category>

		<category><![CDATA[Sun Certified Programmer]]></category>

		<category><![CDATA[tight encapsulation]]></category>

		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=318</guid>
		<description><![CDATA[This Post deal with one of the fundamental concepts about Object Oriented which is called Encapsulation. If you want to aspire to a good Object Oriented Design that&#8217;s one of those  &#8220;rules&#8221; to follow . The Encapsulation  is an arguments to know if you want to overcome with success the Sun Certified Programmer [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/Pib21XjFb_2trFs0fLcQKB5bA3E/0/da"><img src="http://feedads.g.doubleclick.net/~a/Pib21XjFb_2trFs0fLcQKB5bA3E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Pib21XjFb_2trFs0fLcQKB5bA3E/1/da"><img src="http://feedads.g.doubleclick.net/~a/Pib21XjFb_2trFs0fLcQKB5bA3E/1/di" border="0" ismap="true"></img></a></p><p>This Post deal with one of the fundamental concepts about <strong>Object Oriented</strong> which is called <strong>Encapsulation</strong>. If you want to aspire to a good Object Oriented Design that&#8217;s one of those <strong><em> &#8220;rules&#8221;</em></strong> to follow . The <strong>Encapsulation </strong> is an arguments to know if you want to overcome with success the <a title="Sun Certified Programmer for the Java Platform, Standard Edition 6 (CX-310-065)" href="http://www.sun.com/training/catalog/courses/CX-310-065.xml" target="_blank"><strong>Sun Certified Programmer for the Java Platform</strong></a> too. It&#8217;s contained in the <strong><em>Objective 5.1</em></strong> of section 5.</p>
<p><span id="more-318"></span><!--more--></p>
<p><em>* <strong>Develop code that implements tight encapsulation</strong>, loose coupling, and high cohesion in classes, and describe the benefits.</em></p>
<p>Starting with some code so you&#8217;ll understand better the meaning of <strong>Encaspulation</strong>. So we have created a very simple java class like below:</p>
<p>
<pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: true; highlight: [2,3]; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">
public class Car{
	public int speed;
	public int weight;
}
</pre>
</p>
<p>How you can see the <strong>Car</strong> class have two fields <strong>speed</strong> and <strong>weight </strong>both them are <strong>public. </strong>That&#8217;s means anyone can access and modify the fields of class in any way. To show that we have wrote the following java code:</p>
<p>
<pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: true; highlight: [4,5]; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">
public class MyTest{
	public void main(String[] args){
		Car car = new Car();
		car.speed=-20;
		car.weight=5;
	}
}
</pre>
</p>
<p>Now, consider the highlighted statements, how you can guess there are no controls on values of Car class fields. Often that&#8217;s a big problem. Using the <strong>Encapsulation</strong> it allows us to monitor and completely control the values that can be assigned to the class attributes.Then Encapsulation hides attributes by preventing, so access direct can take place only through specific methods. If all attributes are ecapsulated then we talk about <strong>Tight Encapsulation</strong>. Now adjust our class so that it meets the <strong>Encapsulation </strong>, the result will be the following:</p>
<p>
<pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: true; highlight: [5]; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">
public class Car{
	private int speed;
	private int weight;
	public void setSpeed(int value){
		if(value&gt;100){
			this.speed=value;
		}else{
			this.speed=100;
		}
	}
	public int getSpeed(){
		return this.speed;
	}
	public void setWeight(int value){
	// todo - you can define a control for the value entered for Weight field
		this.weight=value;
	}
	public int getWeight(){
		return this.weight;
	}
}
</pre>
</p>
<p>How you can see, it&#8217;s very easy define a class that meets the <strong>Tight Encapsulation</strong> requirements. It&#8217;s enough to specify all fields of the class as <strong>private</strong>, and for each of these defining methods <strong>getter</strong> and <strong>setter</strong> that allow access to the specific field.  The naming convention used is like JavaBeans, see below:</p>
<p><strong><em>set&lt;PropertyName&gt;</em></strong></p>
<p><strong><em>get&lt;PropetyName&gt;</em></strong></p>
<p>Note that the attributes must be strictly defined private and not protected. Using <strong><em>protected</em></strong> means to expose the attributes to derived classes and at the package level which will then have full control. So the access modifier <strong><em>protected</em></strong> should be used only if it&#8217;s really necessary.</p>
<p><div style="text-align:center;"><script type="text/javascript"><!--
google_ad_client = "pub-5270551448254756";
google_ad_slot = "0671009180";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<p>The benefits of using <strong>Tight Encapsulation</strong> are considerable, not only in the case that you decide to perform validation checks on the fields of the class, but mostly because you can hide the implementation of the class making the code more flexible, feasible and extensible. If the attributes of a class are hidden then you can change the implementation without having to change all the classes that use them. The code wrote above can be modified without changing the class MyTest that uses it in the following manner:</p>
<p>
<pre class="brush: java; auto-links: true; collapse: false; first-line: 1; gutter: true; highlight: [2,3,6,8,12,15,18]; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">
public class Car{
	private String speed;
	private String weight;
	public void setSpeed(int value){
		if(value&gt;100){
			this.speed=Integer.toString(value);
		}else{
			this.speed=&amp;quot;100&amp;quot;;
		}
	}
	public int getSpeed(){
		return Integer.parseInt(this.speed);
	}
	public void setWeight(int value){
		this.weight=Integer.toString(value);
	}
	public int getWeight(){
		return Integer.parseInt(this.weight);
	}
}
</pre>
</p>
<p>You may also notice that the Car class has been heavily modified but there are no impacts on other classes that use them. This <strong>Encapsulation</strong> feature is called <strong>Information Hiding</strong>. if you do not have a direct access (public or protected fields) to the class attributes it&#8217;s possible to modify the data type attribute without having to change the points where it is used via getter and setter method , but obviously you don&#8217;t have to change the signature of these methods. Another <strong>Encapsulation</strong> benefit is to make easier the decoupling with other classes, because what&#8217;s hidden can not be coupled.</p>
<p>It&#8217;s always advisable to use as much as possible the <strong>Encapsulation</strong> though initially not expected to do some checks to validate the attributes or write some specific logic in the getter and setter methods. All this can be done later reducing the problem of having to modify the code that uses our class.</p>
<p>That&#8217;s all <img src='http://www.waltscratchpad.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> <br/></p>
<div class='books'>
<h4>Some Books About SCJP and Object Oriented:</h4>
<p><a href="http://www.amazon.com/gp/product/0071591060?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0071591060"><img border="0" width="120px" src="http://www.waltscratchpad.com/images/5196TMHebqL._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=0071591060" width="1" height="1" border="0" alt="" style="border:none !important; margin:8px !important;margin-bottom:0px;"/><a href="http://www.amazon.com/gp/product/0470417978?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0470417978"><img border="0" width="120px" src="http://www.waltscratchpad.com/images/51GMu5z20HL._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=0470417978" width="1" height="1" border="0" alt="" style="border:none !important; margin:8px !important;margin-bottom:0px;" /><a href="http://www.amazon.com/gp/product/0321532058?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0321532058"><img border="0" width="120px" src="http://www.waltscratchpad.com/images/51aN1TjtUxL._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=0321532058" width="1" height="1" border="0" alt="" style="border:none !important; margin:8px !important;margin-bottom:0px;" /><a href="http://www.amazon.com/gp/product/007331708X?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=007331708X"><img border="0" width="120px" src="http://www.waltscratchpad.com/images/51lQ7%2B1O-KL._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=007331708X" width="1" height="1" border="0" alt="" style="border:none !important; margin:8px !important;margin-bottom:0px;" /><script type="text/javascript" src="http://www.assoc-amazon.com/s/link-enhancer?tag=soswebdes04-20&#038;o=1"></script><noscript><img src="http://www.assoc-amazon.com/s/noscript?tag=soswebdes04-20" alt="" /></noscript></div></p>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/giIVe11JKKY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/java/object-oriented-concepts-encapsulation/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/java/object-oriented-concepts-encapsulation/</feedburner:origLink></item>
		<item>
		<title>PL/SQL Integration - Part 1 - Using External Services</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/YeWnstbPZSU/</link>
		<comments>http://www.waltscratchpad.com/database/plsql-integration-part-1-using-external-services/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 20:17:41 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[System Integration]]></category>

		<category><![CDATA[http]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[oracle]]></category>

		<category><![CDATA[pl/sql]]></category>

		<category><![CDATA[rmi]]></category>

		<category><![CDATA[servlet]]></category>

		<category><![CDATA[sql]]></category>

		<category><![CDATA[web-services]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=264</guid>
		<description><![CDATA[More and more we need, for several reasons, to integrate the legacy systems with external services. In this post, we only briefly describe some possible integration between client-server legacy systems, with business logic written in PL/SQL, and Java Services. The picture below show a classical Client-Server Architecture(two-tier) where the server-side is a PL/SQL implementation.

In order [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/dHvt_NoqNmZ-JOr9nsFEolNIxf4/0/da"><img src="http://feedads.g.doubleclick.net/~a/dHvt_NoqNmZ-JOr9nsFEolNIxf4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dHvt_NoqNmZ-JOr9nsFEolNIxf4/1/da"><img src="http://feedads.g.doubleclick.net/~a/dHvt_NoqNmZ-JOr9nsFEolNIxf4/1/di" border="0" ismap="true"></img></a></p><p>More and more we need, for several reasons, to<strong> integrate the legacy systems with external services</strong>. In this post, we only briefly describe some possible integration between <em><strong>client-server legacy systems, with business logic written in PL/SQL, and Java Services. </strong></em><span id="more-264"></span>The picture below show a <strong>classical Client-Server Architecture</strong>(<strong>two-tier</strong>) where the <strong>server-side</strong> is a <strong>PL/SQL</strong> implementation.</p>
<p style="text-align: center;"><img class="aligncenter" title="Client-Server PL/SQL Architecture" src="http://www.waltscratchpad.com/images/client_server.jpg" alt="" width="327" height="218" /></p>
<p>In order <em>to take advantage </em>of external services we have to change the Architeture of our legacy system. To do this we must, in some way<strong>, </strong><em><strong>interfacing the PL/SQL</strong> with a software layer which acts as a <strong>wrapper</strong> between the <strong>procedures written in PL/SQL</strong> and the external world.</em> The picture below show our Architecture changed in a <strong>Three-Tier Architecture</strong>.</p>
<p style="text-align: center;"><img class="aligncenter" title="Three tier Architecture" src="http://www.waltscratchpad.com/images/client_server_services.jpg" alt="" width="536" height="386" /></p>
<p><em><strong>Oracle</strong> offers many possibilities for integrating the Store Procedure written in PL /SQL with other systems.</em> It&#8217;s possible to consume several kind of services from oracle database. In order to do this, <strong>Oracle</strong> provides two packages, <strong>utl_http </strong>and<strong> utl_dbws</strong><!--[if !mso]> <mce:style><!  v:* {behavior:url(#default#VML);} o:* {behavior:url(#default#VML);} p:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} v:textbox {display:none;} --> that allow to consume custom HTTP Services and Web Services. An other alternative<!--  --> is loading any Java jar(library) needed, writing some custom Java code in oracle db and creating a PL/SQL wrapper. So, it&#8217;s possible also interfacing with any type of Java Services like RMI Server, EJB and so on.  I<span class="clickable" onclick="dr4sdgryt(event,&quot;Ox&quot;)"><span class="hg"><span class="hw">n the next posts</span> </span></span>we&#8217;ll examine,in more details, <em>some possible integrations</em> with systems written in <strong>Java</strong>.<br />
<div style="text-align:center;"><script type="text/javascript"><!--
google_ad_client = "pub-5270551448254756";
google_ad_slot = "0671009180";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/YeWnstbPZSU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/database/plsql-integration-part-1-using-external-services/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/database/plsql-integration-part-1-using-external-services/</feedburner:origLink></item>
		<item>
		<title>Improve your Blog - 2 - Choosing the Theme</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/bD_Q3gxWctY/</link>
		<comments>http://www.waltscratchpad.com/tipstricks/improve-your-blog-2-choosing-the-theme/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 15:11:58 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[tips&tricks]]></category>

		<category><![CDATA[blog]]></category>

		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=231</guid>
		<description><![CDATA[When you need to create a new blog with Wordpress, you have to define the layout and the design of our web site. To do so, you must to create or choose a Wordpress Theme . If you have no experience, it&#8217;s better to start choosing a free Wordpress Theme. There are so many free [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/9RMmiAQNaXlkKMN0MLHyRZFK-ho/0/da"><img src="http://feedads.g.doubleclick.net/~a/9RMmiAQNaXlkKMN0MLHyRZFK-ho/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/9RMmiAQNaXlkKMN0MLHyRZFK-ho/1/da"><img src="http://feedads.g.doubleclick.net/~a/9RMmiAQNaXlkKMN0MLHyRZFK-ho/1/di" border="0" ismap="true"></img></a></p><p>When you need to create a new blog with <strong>Wordpress</strong>, you have to define the layout and the design of our web site. To do so, you must to create or choose a <strong>Wordpress</strong> <strong>Theme</strong> . If you have no experience, it&#8217;s better to start choosing a free <strong>Wordpress Theme</strong>. There are so many free themes on internet. Try to search with <a title="WordPress themes" href="http://www.google.com/cse?cx=partner-pub-5270551448254756%3Aol2eo8-ckoh&amp;ie=ISO-8859-1&amp;q=wordpress+themes&amp;sa=Search" target="_blank">Google</a>. <span id="more-231"></span><br />
It&#8217;s very hard, maybe impossible, to evaluate all of these <strong>Wordpress Themes</strong>. Moreover, <em>you have to consider the time to spend to customize the theme</em> that you have chosen to adapt your needs too. I think, therefore, you take needless risks to spend a lot of time to do all that. Rather, <em>you could spend it, with more benefits, writing some POSTs</em>.<br />
How do you procede? That&#8217;s enough don&#8217;t let curiosity get the best of you to find the ideal theme. Yes, I know, <em>It could be difficult to limit own curiosity</em>, but with some effort it&#8217;s possible to do everything. So initially, choose a simple and elegant <strong>Wordpress Theme</strong> and customize it with small steps. Remember, <strong><em>the most important thing in a blog is the Content.</em></strong><br />
Personally, I have chosen how initial theme <a title="iNove wordpress theme " href="http://wordpress.org/extend/themes/inove" target="_blank">inove</a>. It&#8217;s very simple and elegant and I did some small changes.<br />
However, in <a title="WordPress themes" href="http://wordpress.org/extend/themes/">Wordpress</a> site you can find a <em>considerable number of themes</em>, you can find a lot of interesting and<strong> free Wordpress themes</strong> also <a title="Free Wordpress Themes" href="http://wordpressthemesbase.com/">here</a>. A last advise, choose the first theme that you think it&#8217;s OK and don&#8217;t worry about the initial layout of your blog, there is always the time to improve or change it.<br />
<div style="text-align:center;"><script type="text/javascript"><!--
google_ad_client = "pub-5270551448254756";
google_ad_slot = "0671009180";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div></p>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/bD_Q3gxWctY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/tipstricks/improve-your-blog-2-choosing-the-theme/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/tipstricks/improve-your-blog-2-choosing-the-theme/</feedburner:origLink></item>
		<item>
		<title>Improve your Blog - 1 - Choosing the blog platform</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/7rKQql9rgK8/</link>
		<comments>http://www.waltscratchpad.com/tipstricks/improve-your-blog-1-choosing-the-blog-platform/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 18:42:46 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[tips&tricks]]></category>

		<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=183</guid>
		<description><![CDATA[The first thing you need to decide is whether using a free blog service like wordpress.com or whether building an own blog, subscribing a web hosting service and buying a domain. In both cases there are so many possible solutions.
For those who don&#8217;t need the flexibility of a full web hosting service and don&#8217;t want [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/SNt53q-5s1V1VfyVDBzbIcih3sE/0/da"><img src="http://feedads.g.doubleclick.net/~a/SNt53q-5s1V1VfyVDBzbIcih3sE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/SNt53q-5s1V1VfyVDBzbIcih3sE/1/da"><img src="http://feedads.g.doubleclick.net/~a/SNt53q-5s1V1VfyVDBzbIcih3sE/1/di" border="0" ismap="true"></img></a></p><p>The first thing you need to decide is whether using a<strong> free blog service</strong> like <strong><a title="WordPress.com" href="http://wordpress.com" target="_blank">wordpress.com</a> </strong>or whether <em>building an own blog</em>, <em>subscribing a web hosting service</em> and <em>buying a domain</em>. In both cases there are so many possible solutions.<br />
<span id="more-183"></span>For those who don&#8217;t need the flexibility of a full web hosting service and don&#8217;t want directly manage the own web site the best solution is using a <strong>free blog service</strong>. In this case, there are many solutions too. Some chooses are <strong><a href="http://www.blogger.com/">Blogger.com</a>, <a href="http://www.wordpress.com/">WordPress.com</a>, <a href="http://spaces.msn.com/">MSN Spaces</a>, <a href="http://www.typepad.com/">TypePad.</a></strong><br />
<strong><em>More interesting but more hard is building an own blog</em></strong>. In this case, you can choose a blog platform you have to use and then choose the web hosting service to subscribe. Also in this case there are so many possibilities, but the choice  is almost obligatory. This choice is <strong><a title="WordPress.org" href="http://www.wordpress.org" target="_blank">WordPress</a></strong>. Why do I assert that? Try a google search on word <a title="Google search &quot;Wordpress&quot;" href="http://www.google.com/cse?cx=partner-pub-5270551448254756%3Aol2eo8-ckoh&amp;ie=ISO-8859-1&amp;q=wordpress&amp;sa=Search" target="_blank"><strong>wordpress</strong></a>. There are <em>countless plugins</em> <em>and themes</em> available for WordPress, there are countless communities and people that using and speaking about wordpress, then it&#8217;s possible to acquire any kind of information and you can customzie your blog how you want. So, I think it&#8217;s better don&#8217;t spend mutch time to find the best blog platform that you can use for your blog. However, if you like have more details about blog platform you can see the follows links:</p>
<ul>
<li><a title="Choosing a Blog Platform" href="http://www.problogger.net/archives/2006/02/15/choosing-a-blog-platform/" target="_blank"><strong>Choosing a Blog Platform</strong></a></li>
<li><strong><a title="PHP Open Source Blog" href="http://php.opensourcecms.com/scripts/show.php?catid=2&amp;cat=Blogs" target="_blank">PHP Open Source Blog</a></strong></li>
<li><strong><a title="ASPX Open Source Blog" href="http://aspx.opensourcecms.com/scripts/show.php?catid=24&amp;cat=Blogs" target="_blank">ASPX Open Source Blog</a></strong></li>
</ul>
<div class="books">
<h4>Some Books about Blogs and Wordpress:</h4>
<p><a href="http://www.amazon.com/gp/product/0470230177?ie=UTF8&amp;tag=soswebdes04-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470230177"><img style="width: 20%; height: 20%;" src="http://www.waltscratchpad.com/images/517zm3H0a1L._SL160_.jpg" border="0" alt="" /></a><img style="border:none !important; margin:8px !important;margin-bottom:0px;" src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&amp;l=as2&amp;o=1&amp;a=0470230177" border="0" alt="" width="1" height="1" /><a href="http://www.amazon.com/gp/product/0470402962?ie=UTF8&amp;tag=soswebdes04-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470402962"><img style="width: 20%; height: 20%;" src="http://www.waltscratchpad.com/images/51XaD5m0kAL._SL160_.jpg" border="0" alt="" /></a><img style="border:none !important; margin:8px !important;margin-bottom:0px;" src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&amp;l=as2&amp;o=1&amp;a=0470402962" border="0" alt="" width="1" height="1" /><a href="http://www.amazon.com/gp/product/0321591933?ie=UTF8&amp;tag=soswebdes04-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321591933"><img style="width: 20%; height: 20%;" src="http://www.waltscratchpad.com/images/41Gc6yg5r1L._SL160_.jpg" border="0" alt="" /></a><img style="border:none !important; margin:8px !important;margin-bottom:0px;" src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&amp;l=as2&amp;o=1&amp;a=0321591933" border="0" alt="" width="1" height="1" /><a href="http://www.amazon.com/gp/product/1441482490?ie=UTF8&amp;tag=soswebdes04-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1441482490"><img style="width: 20%; height: 20%;" src="http://www.waltscratchpad.com/images/51RG2BvMnEZL._SL160_.jpg" border="0" alt="" /></a><img style="border:none !important; margin:8px !important;margin-bottom:0px;" src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&amp;l=as2&amp;o=1&amp;a=1441482490" border="0" alt="" width="1" height="1" /><script src="http://www.assoc-amazon.com/s/link-enhancer?tag=soswebdes04-20&amp;o=1" type="text/javascript"></script><noscript>&amp;amp;lt;img src=&#8221;http://www.assoc-amazon.com/s/noscript?tag=soswebdes04-20&#8243; mce_src=&#8221;http://www.assoc-amazon.com/s/noscript?tag=soswebdes04-20&#8243; alt=&#8221;" /&amp;amp;gt;</noscript></div>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/7rKQql9rgK8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/tipstricks/improve-your-blog-1-choosing-the-blog-platform/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/tipstricks/improve-your-blog-1-choosing-the-blog-platform/</feedburner:origLink></item>
		<item>
		<title>Installing Apache2 on Unix-Like System</title>
		<link>http://feedproxy.google.com/~r/WaltsScratchPad/~3/ZtA2O7mrkR4/</link>
		<comments>http://www.waltscratchpad.com/apache/installing-apache2-on-unix-like-system/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 19:27:38 +0000</pubDate>
		<dc:creator>walt</dc:creator>
		
		<category><![CDATA[Apache]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[Unix-Like System]]></category>

		<category><![CDATA[http]]></category>

		<category><![CDATA[install]]></category>

		<category><![CDATA[Open Solaris]]></category>

		<category><![CDATA[Open Suse]]></category>

		<category><![CDATA[Unix]]></category>

		<category><![CDATA[Unix-Like]]></category>

		<category><![CDATA[Web Server]]></category>

		<guid isPermaLink="false">http://www.waltscratchpad.com/?p=11</guid>
		<description><![CDATA[This post is a step-to-step tutorial to install Apache 2 from source-code on Unix-Like Systems like Linux, Open Solaris and FreeBSD. 

Step 1 - Verifying the Requirements

The Disk Space that you need for the Apache installation must be at least 50MB. In any case Apache use about 10 MB after the installation.
ANSI-C Compiler - On [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/wuwHmAWo9AnmT2KwXkVhYHKL7TY/0/da"><img src="http://feedads.g.doubleclick.net/~a/wuwHmAWo9AnmT2KwXkVhYHKL7TY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wuwHmAWo9AnmT2KwXkVhYHKL7TY/1/da"><img src="http://feedads.g.doubleclick.net/~a/wuwHmAWo9AnmT2KwXkVhYHKL7TY/1/di" border="0" ismap="true"></img></a></p><p>This post is a step-to-step tutorial to install <strong>Apache 2</strong> from source-code on Unix-Like Systems like <a title="Open SUSE - My Best Linux Distribution" href="http://www.opensuse.org" target="_blank">Linux</a>, <a title="Open Solaris Web Site" href="http://www.opensolaris.org" target="_blank">Open Solaris</a> and <a title="FreeBSD Web Site" href="http://www.freebsd.org" target="_blank">FreeBSD. </a><strong></strong><br />
<span id="more-11"></span><br />
<strong>Step 1 - Verifying the Requirements</strong></p>
<ul style="text-align: left;">
<li>The <strong>Disk Space</strong> that you need for the Apache installation must be at least <strong>50MB</strong>. In any case Apache use about 10 MB after the installation.</li>
<li><strong>ANSI-C Compiler</strong> - On your system you must have an ANSI-C compiler installed like the <a title="GNU C Compiler" href="http://www.gnu.org/software/gcc/gcc.html" target="_blank">GNU C Compiler (GCC).</a></li>
<li><strong>Packages and Libraries</strong> - Some packages and libraries are needed to install Apache. Some packages are <a title="Make tool" href="http://www.gnu.org/software/make/" target="_blank">make</a>, <a title="Autoconf Package" href="http://www.gnu.org/software/autoconf/" target="_blank">autoconf</a>, <a title="GNU libtool Library" href="http://www.gnu.org/software/libtool/" target="_blank">libtool</a>, <a title="OpenSSL Project" href="http://www.openssl.org/" target="_blank">OpenSSL</a>.</li>
<li><strong>Optional Requirements </strong>- Apache can use some scripts, like apxs, which are written in Perl. That depends on your apache configuration, so it&#8217;s possible that you need the <a title="Perl" href="http://www.perl.com" target="_blank">Perl 5 Interpreter</a>.</li>
</ul>
<p><strong>Step 2 - Download &amp; Extract Apache Source Code</strong><br />
<span class="clickable" onclick="dr4sdgryt(event,&quot;Ox&quot;)"><span class="hg"><span class="hw">In succession some simple steps to download and extract the Apache source code. Steps below are tested on <a title="Open Suse Web Site" href="http://www.opensuse.org" target="_blank">Open Suse </a>11.1 Linux distribution but i think that you can follow their without change or, at most, with some little difference. In order to install Apache2 you have to get the source code and then you have to extract the files from the tar.gz archive downloaded. So you have choose the url where you get the apache source code. In the example, I have chosen the apache version 2.2.11, you can get <a title="Apache HTTPD version 2.2.11" href="http://www.apache.org/dist/httpd/httpd-2.2.11.tar.gz" target="_blank">here</a>.  Below you can see the Apache download step using <strong>wget</strong> unix/linux command:</span></span></span></p>
<div class="highlight"><code><em><span style="color: #ff0000;"><strong>/usr/local/src # wget http://www.apache.org/dist/httpd/httpd-2.2.11.tar.gz</strong> </span></em><br />
<em>&#8211;2009-03-02 11:07:29&#8211; http://www.apache.org/dist/httpd/httpd-2.2.11.tar.gz </em><br />
<em>Resolving www.apache.org&#8230; 192.87.106.226 </em><br />
<em>Connecting to www.apache.org|192.87.106.226|:80&#8230; connected. </em><br />
<em>HTTP request sent, awaiting response&#8230; 200 OK Length: 6806786 (6.5M) [application/x-gzip] </em><br />
<em>Saving to: `httpd-2.2.11.tar.gz.1&#8242;</em><br />
<em>[100%=========================================&gt;] 6,806,786 1.29M/s in 8.1s</em><br />
<em>2009-03-02 11:07:37 (824 KB/s) - `httpd-2.2.11.tar.gz.1&#8242; saved [6806786/6806786] </em><br />
<em><strong><span style="color: #ff0000;">/usr/local/src #</span></strong></em></code></div>
<p><em></em> After downloaded the code you have to extract it. In the example, I have used the &#8217;<em>/usr/local/src&#8217; </em>path but you can use what you want of course. Below the step to extract the code using <strong>tar</strong> unix/linux command:</p>
<div class="highlight"><code><em><span style="color: #ff0000;"><strong>/usr/local/src # tar xzvf httpd-2.2.11.tar.gz</strong></span></em><br />
<em>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</em><br />
<em>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</em><br />
<em>httpd-2.2.11/modules/debug/README</em><br />
<em>httpd-2.2.11/README</em><br />
<em>httpd-2.2.11/apachenw.mcp.zip</em><br />
<em>httpd-2.2.11/buildconf</em><br />
<em>httpd-2.2.11/libhttpd.dsp</em><br />
<em>httpd-2.2.11/LAYOUT</em><br />
<em>httpd-2.2.11/.deps </em><br />
<em><strong><span style="color: #ff0000;">usr/local/src #</span></strong></em></code></div>
<p><strong>Step 3 - Configure Apache </strong><br />
Before installing Apache you have to configure it. That&#8217;s a very important step to fit and customize the installation for your platform and need. In the example below, I have used some option to customize my apache installation.  Below there are some option descriptions and reference link that I&#8217;ve used in my Apache installation.</p>
<ul>
<li><strong>&#8211;with-included-apr </strong>- This option allows to use the <a title="apr &amp; apr-util" href="http://apr.apache.org/" target="_blank">apr and apr-util</a> 1.2 libraries bundled with apache distribution simplified the installation, so you don&#8217;t have any problems if your system have an older version than 1.2.</li>
<li><strong>&#8211;prefix=/usr/local/myapache2 - </strong>This option allows to define a directory installation. The default value is /usr/local/apache2.</li>
<li><strong>&#8211;enable-maintainer-mode - </strong>It allows to enable the debug and warnings during the installation process. I think is a useful option to understand what happen during the installation.</li>
<li><strong>&#8211;enable-dav- </strong>With this option it&#8217;s possible to enable the WebDAV protocol. See <a title="Distributed Authoring and Versioning (WebDAV) functionality" href="http://httpd.apache.org/docs/2.2/mod/mod_dav.html" target="_blank">here</a> for more details.</li>
<li><strong>&#8211;enable-dav-fs - </strong>See <a title="filesystem provider for mod_dav" href="http://httpd.apache.org/docs/2.2/mod/mod_dav_fs.html" target="_blank">here</a> for more details.</li>
<li><strong>&#8211;enable-dav-lock - </strong>See <a title="generic locking module for mod_dav" href="http://httpd.apache.org/docs/2.2/mod/mod_dav_lock.html" target="_blank">here</a> for more details.</li>
<li><strong>&#8211;enable-auth-digest -</strong> Enable the apache module <a title="User authentication using MD5 Digest Authentication" href="http://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html" target="_blank">mod_auth_digest</a>for user authentication using MD5 Digest Authentication.</li>
<li><strong>&#8211;enable-rewrite - Enable the apache module </strong><a title="Provides a rule-based rewriting engine to rewrite requested URLs on the fly" href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" target="_blank"><strong>mod_rewrite</strong></a><strong> to allow </strong>to rewrite requested URLs on the fly. This option is very useful in many case, think about using the permalink in WordPress for example. <a title="Ask Apache web site" href="http://www.askapache.com/" target="_blank">AskApache</a> is a good web site about Apache, you can find more information and <a id="mod_rewrite-tips-tricks" class="acd" title="mod_rewrite RewriteRule and RewriteCond tips and tricks" name="mod_rewrite-tips-tricks">tips and tricks</a> about apache module mod_rewrite <a title="htaccess rewrite, Mod_rewrite tricks" href="http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html#default-mod-rewrite-hint" target="_blank">here</a>.</li>
<li><strong>&#8211;enable-ssl=/usr/ssl</strong> - With this option you can use the protocols SSL/TLS using the apache module <a title="Strong cryptography using the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols" href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html" target="_blank">mod_ssl</a>.</li>
</ul>
<p>You can also use the default Apache configuration of course. In this case you have use the <strong>configure</strong> script without options. To know more details see the Apache HTTPD site <a title="Apache HTTPD Site - Configuration" href="http://httpd.apache.org/docs/2.2/programs/configure.html" target="_blank">here</a>. Below you can see the Apache configuration step on my system. Remember you must to use the root user to execute the configure script.</p>
<div class="highlight"><code><em><strong><span style="color: #ff0000;">/usr/local/src/httpd-2.2.11 # ./configure &#8211;with-included-apr &#8211;prefix=/usr/local/myapache2 &#8211;enable-mods-shared=&#8221;all ssl dav_lock&#8221; &#8211;enable-maintainer-mode &#8211;enable-dav &#8211;enable-dav-fs &#8211;enable-dav-lock &#8211;enable-deflate &#8211;enable-auth-digest &#8211;enable-rewrite &#8211;enable-actions &#8211;enable-so &#8211;enable-ssl=/usr/ssl</span></strong></em><br />
<em>checking for chosen layout&#8230;</em><br />
<em>Apache checking for working mkdir -p&#8230;</em><br />
<em>yes checking build system type&#8230;</em><br />
<em>i686-pc-linux-gnu checking host system type&#8230;</em><br />
<em>i686-pc-linux-gnu checking target system type&#8230;</em><br />
<em>i686-pc-linux-gnu Configuring Apache Portable Runtime library &#8230;</em><br />
<em>configuring package in srclib/apr now </em><br />
<em>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</em><br />
<em>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..</em><br />
<em>config.status: creating include/ap_config_layout.h</em><br />
<em>config.status: creating support/apxs</em><br />
<em>config.status: creating support/apachectl</em><br />
<em>config.status: creating support/dbmmanage</em><br />
<em>config.status: creating support/envvars-std</em><br />
<em>config.status: creating support/log_server_status</em><br />
<em>config.status: creating support/logresolve.pl</em><br />
<em>config.status: creating support/phf_abuse_log.cgi</em><br />
<em>config.status: creating support/split-logfile</em><br />
<em>config.status: creating build/rules.mk</em><br />
<em>config.status: creating build/pkg/pkginfo</em><br />
<em>config.status: creating build/config_vars.sh</em><br />
<em>config.status: creating include/ap_config_auto.h</em><br />
<em>config.status: executing default commands</em><br />
<em><strong><span style="color: #ff0000;">/usr/local/src/httpd-2.2.11 #</span></strong></em></code></div>
<p><strong>Step 4 - Build &amp; Install Apache</strong><br />
Finally we can build and Install our Apache HTTP Server. This step is very simple and doesn&#8217;t need a lot of comments. Starting to build it we have to use only make command:</p>
<div class="highlight"><code><em><strong><span style="color: #ff0000;">/usr/local/src/httpd-2.2.11 # make</span> </strong></em><br />
<em>Making all in srclib make[1]: Entering directory `/usr/local/src/httpd-2.2.11/srclib&#8217;</em><br />
<em>Making all in apr make[2]: Entering directory `/usr/local/src/httpd-2.2.11/srclib/apr&#8217;</em><br />
<em>make[3]: Entering directory `/usr/local/src/httpd-2.2.11/srclib/apr&#8217;</em><br />
<em>/bin/sh /usr/local/src/httpd-2.2.11/srclib/apr/libtool &#8211;silent &#8211;mode=compile gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I./include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include  -o passwd/apr_getpass.lo -c passwd/apr_getpass.c &amp;&amp; touch passwd/apr_getpass.lo</em><br />
<em>/bin/sh /usr/local/src/httpd-2.2.11/srclib/apr/libtool &#8211;silent &#8211;mode=compile gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I./include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include  -o strings/apr_fnmatch.lo -c strings/apr_fnmatch.c &amp;&amp; touch strings/apr_fnmatch.lo</em><br />
<em>/bin/sh /usr/local/src/httpd-2.2.11/srclib/apr/libtool &#8211;silent &#8211;mode=compile gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I./include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include  -o strings/apr_strnatcmp.lo -c strings/apr_strnatcmp.c &amp;&amp; touch strings/apr_strnatcmp.lo</em><br />
<em>/bin/sh /usr/local/src/httpd-2.2.11/srclib/apr/libtool &#8211;silent &#8211;mode=compile gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I./include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include  -o strings/apr_snprintf.lo -c strings/apr_snprintf.c &amp;&amp; touch strings/apr_snprintf.lo</em><br />
<em>^Cmake[3]: *** [strings/apr_snprintf.lo] Interrupt</em><br />
<em>make[2]: *** [all-recursive] Interrupt</em><br />
<em>make[1]: *** [all-recursive] Interrupt</em><br />
<em>make: *** [all-recursive] Interrupt</em><br />
<em><strong><span style="color: #ff0000;">/usr/local/src/httpd-2.2.11 #</span></strong></em></code></div>
<p>Then we can install the Apache HTTP Server. It&#8217;s a very simple step. It&#8217;s enough to use the command <em>make install </em>and then after, some minutes, you have your Apache Web Server installed <img src='http://www.waltscratchpad.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . Below you can see the Apache installation step executed on my system.</p>
<div class="highlight"><code><strong><em><span style="color: #ff0000;">usr/local/src/httpd-2.2.11 # make install </span></em></strong><br />
<em>Making install in srclib make[1]: Entering directory `/usr/local/src/httpd-2.2.11/srclib&#8217;</em><br />
<em>Making install in apr make[2]: Entering directory `/usr/local/src/httpd-2.2.11/srclib/apr&#8217;</em><br />
<em>/bin/sh /usr/local/src/httpd-2.2.11/srclib/apr/libtool &#8211;silent &#8211;mode=compile gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I./include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include  -o strings/apr_snprintf.lo -c strings/apr_snprintf.c &amp;&amp; touch strings/apr_snprintf.lo</em><br />
<em>/bin/sh /usr/local/src/httpd-2.2.11/srclib/apr/libtool &#8211;silent &#8211;mode=compile gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I./include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include/arch/unix -I/usr/local/src/httpd-2.2.11/srclib/apr/include  -o strings/apr_strings.lo -c strings/apr_strings.c &amp;&amp; touch strings/apr_strings.lo</em><br />
<em>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.</em><br />
<em>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.</em><br />
<em>Installing configuration files</em><br />
<em>mkdir /usr/local/myapache2/conf</em><br />
<em>mkdir /usr/local/myapache2/conf/extra</em><br />
<em>mkdir /usr/local/myapache2/conf/original</em><br />
<em>mkdir /usr/local/myapache2/conf/original/extra</em><br />
<em>Installing HTML documents</em><br />
<em>mkdir /usr/local/myapache2/htdocs</em><br />
<em>Installing error documents</em><br />
<em>mkdir /usr/local/myapache2/error</em><br />
<em>Installing icons</em><br />
<em>mkdir /usr/local/myapache2/icons</em><br />
<em>mkdir /usr/local/myapache2/logs</em><br />
<em>Installing CGIs</em><br />
<em>mkdir /usr/local/myapache2/cgi-bin</em><br />
<em>Installing header files Installing build system files</em><br />
<em>Installing man pages and online manual</em><br />
<em>mkdir /usr/local/myapache2/man</em><br />
<em>mkdir /usr/local/myapache2/man/man1</em><br />
<em>mkdir /usr/local/myapache2/man/man8</em><br />
<em>mkdir /usr/local/myapache2/manual</em><br />
<em>make[1]: Leaving directory `/usr/local/src/httpd-2.2.11&#8242;</em><br />
<strong><em><span style="color: #ff0000;">usr/local/src/httpd-2.2.11 #</span></em></strong></code></div>
<p><strong>Step 5 -Customize &amp; Start/Stop Command </strong><br />
This is the last step of our tutorial, we have to customize and test the start/stop of our installation to verify is all OK. I hope so :-) . To customize your Apache Web Server you have to change the <strong>httpd.conf</strong> file. You can find this file on <em>PREFIX</em>/conf/ directory where <em>PREFIX</em> is the directory where you have chosen to install the web server. In my installation the directory is /usr/local/myapache2. To know more details see <a title="Apache HTTPD Configuration" href="http://httpd.apache.org/docs/2.2/configuring.html" target="_blank">here</a>.  Now and finally, we can test our installation. So for starting the web server you have to use the command <em>PREFIX</em>/bin/<strong>apachectl -k start. </strong>Below the step in my installation:</p>
<div class="highlight"><strong><code><span style="color: #ff0000;"><em>/usr/local/src/httpd-2.2.11 # cd /usr/local/myapache2/bin</em><br />
<em>/usr/local/myapache2/bin # ./apachectl -k start</em><br />
<em>/usr/local/myapache2/bin #</em></span></code></strong></div>
<p>To test if your web server is started correctly you can use a browser and go to <code>http://your_host_name/</code> if the starting is OK you&#8217;ll se the Apache2 home page like this:</p>
<div class="wp-caption alignnone" style="width: 574px"><img style="border: black 1px solid;" title="Apache HTTP Server Screenshot" src="http://www.waltscratchpad.com/images/apache_screenshot.png" alt="Apache HTTP Server Screenshot" width="564" height="452" /><p class="wp-caption-text">Apache HTTP Server Screenshot</p></div>
<p>At the end, We&#8217;re going to try to stop the Apache Web Server. That&#8217;s very simple, see below.</p>
<div class="highlight"><strong><span style="color: #ff0000; font-family: Courier New;"><code><em>/usr/local/myapache2/bin # ./apachectl -k stop</em><br />
<em>/usr/local/myapache2/bin #</em></code></span></strong></div>
<p>If you&#8217;d like, you can verify if the Apache Web Server is stopped correctly using browser like already you&#8217;ve seen above. You can also test the Apache start/stop using only wget command like showing below:</p>
<div class="highlight"><code><strong><span style="color: #ff0000;"><em>/usr/local/myapache2/bin # ./apachectl -k start</em><br />
<em>/usr/local/myapache2/bin # wget http://localhost</em></span> </strong><br />
<em>&#8211;2009-03-04 10:26:55&#8211; http://localhost/ Resolving localhost&#8230; 127.0.0.1</em><br />
<em>Connecting to localhost|127.0.0.1|:80&#8230; connected.</em><br />
<em>HTTP request sent, awaiting response&#8230; 200 OK Length: 44  Saving to: `index.html.1&#8242;</em> <em>100%[============================================&gt;] 44  &#8211;.-K/s   in 0s</em> <em>2009-03-04 10:26:55 (1.25 MB/s) - `index.html.1&#8242; saved [44/44]</em><br />
<strong><span style="color: #ff0000;"><em>/usr/local/myapache2/bin # ./apachectl -k stop</em><br />
<em>/usr/local/myapache2/bin # wget http://localhost</em></span></strong><br />
<em>&#8211;2009-03-04 10:27:06&#8211; http://localhost/</em><br />
<em>Resolving localhost&#8230; 127.0.0.1</em><br />
<em>Connecting to localhost|127.0.0.1|:80&#8230; failed: Connection refused.</em><br />
<em><strong><span style="color: #ff0000;">/usr/local/myapache2/bin #</span></strong></em></code></div>
<p>I think that&#8217;s all. Enjoy your new Apache Installation <img src='http://www.waltscratchpad.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<br/></p>
<div class='books'>
<h4>Some Books about Apache:</h4>
<p><a href="http://www.amazon.com/gp/product/0596529945?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0596529945"><img border="0" src="http://www.waltscratchpad.com/images/51s0Dy8Qz8L._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=0596529945" width="1" height="1" border="0" alt="" style="border:none !important; margin:12px !important;margin-bottom:0px;" /><a href="http://www.amazon.com/gp/product/1590593006?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1590593006"><img border="0" src="http://www.waltscratchpad.com/images/51u5wzyRzdL._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=1590593006" width="1" height="1" border="0" alt="" style="border:none !important; margin:12px !important;margin-bottom:0px;" /><a href="http://www.amazon.com/gp/product/0596002033?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0596002033"><img border="0" src="http://www.waltscratchpad.com/images/51nj1sD61JL._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=0596002033" width="1" height="1" border="0" alt="" style="border:none !important; margin:12px !important;margin-bottom:0px;" /><a href="http://www.amazon.com/gp/product/0596518889?ie=UTF8&#038;tag=soswebdes04-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0596518889"><img border="0" src="http://www.waltscratchpad.com/images/41PzL9VQNBL._SL160_.jpg"></a><img src="http://www.assoc-amazon.com/e/ir?t=soswebdes04-20&#038;l=as2&#038;o=1&#038;a=0596518889" width="1" height="1" border="0" alt="" style="border:none !important; margin:12px !important;margin-bottom:0px;" /><script type="text/javascript" src="http://www.assoc-amazon.com/s/link-enhancer?tag=soswebdes04-20&#038;o=1"></script><noscript><img src="http://www.assoc-amazon.com/s/noscript?tag=soswebdes04-20" alt="" /></noscript></div>
<img src="http://feeds.feedburner.com/~r/WaltsScratchPad/~4/ZtA2O7mrkR4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.waltscratchpad.com/apache/installing-apache2-on-unix-like-system/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.waltscratchpad.com/apache/installing-apache2-on-unix-like-system/</feedburner:origLink></item>
	</channel>
</rss>

