<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux Ask! &#187; Programming</title>
	<atom:link href="http://www.linuxask.com/topics/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxask.com</link>
	<description>Linux Ask! is a Q &#38; A web site specific for Linux related questions such as how to use common Linux commands.</description>
	<lastBuildDate>Sat, 04 Feb 2012 05:57:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to uncompress a WAR file using command</title>
		<link>http://www.linuxask.com/questions/how-to-uncompress-a-war-file-using-command</link>
		<comments>http://www.linuxask.com/questions/how-to-uncompress-a-war-file-using-command#comments</comments>
		<pubDate>Tue, 10 Jan 2012 15:42:27 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3623</guid>
		<description><![CDATA[How to uncompress a WAR file using command Answer: To un-compress a Java Web Archives file (*.war), you can use the command # jar xvf my-app.war Related posts: Changing the default Java environment in Ubuntu Compress and decompress file using 7zip Determine file type using the file command
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/changing-the-default-java-environment-in-ubuntu' rel='bookmark' title='Changing the default Java environment in Ubuntu'>Changing the default Java environment in Ubuntu</a></li>
<li><a href='http://www.linuxask.com/questions/compress-and-decompress-file-using-7zip' rel='bookmark' title='Compress and decompress file using 7zip'>Compress and decompress file using 7zip</a></li>
<li><a href='http://www.linuxask.com/questions/determine-file-type-using-the-file-command' rel='bookmark' title='Determine file type using the file command'>Determine file type using the file command</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>How to uncompress a WAR file using command</p>
<p><strong>Answer:</strong></p>
<p>To un-compress a Java Web Archives file (*.war), you can use the command</p>
<p><code># jar xvf my-app.war</code></p>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/changing-the-default-java-environment-in-ubuntu' rel='bookmark' title='Changing the default Java environment in Ubuntu'>Changing the default Java environment in Ubuntu</a></li>
<li><a href='http://www.linuxask.com/questions/compress-and-decompress-file-using-7zip' rel='bookmark' title='Compress and decompress file using 7zip'>Compress and decompress file using 7zip</a></li>
<li><a href='http://www.linuxask.com/questions/determine-file-type-using-the-file-command' rel='bookmark' title='Determine file type using the file command'>Determine file type using the file command</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-to-uncompress-a-war-file-using-command/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World in different scripting languages</title>
		<link>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages</link>
		<comments>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages#comments</comments>
		<pubDate>Wed, 28 Sep 2011 10:44:11 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3528</guid>
		<description><![CDATA[Print to standard output in different scripting languages Answer: To print a string of "Hello World" to the standard output in different scripting languages 1. Perl print "Hello, World!"; 2. Python print('Hello, World!') 3. PHP echo "Hello, World!"; 4. Ruby puts "Hello, World!" Related posts: Multi-line string in Ruby How to perform syntax check for <a href='http://www.linuxask.com/questions/hello-world-in-different-scripting-languages'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/multi-line-string-in-ruby' rel='bookmark' title='Multi-line string in Ruby'>Multi-line string in Ruby</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-perform-syntax-check-for-python-program' rel='bookmark' title='How to perform syntax check for Python program'>How to perform syntax check for Python program</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-modify-a-single-character-in-a-string-in-python' rel='bookmark' title='How to modify a single character in a string in Python?'>How to modify a single character in a string in Python?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Print to standard output in different scripting languages</p>
<p><strong>Answer:</strong></p>
<p>To print a string of "<strong>Hello World</strong>" to the standard output in different scripting languages</p>
<p><strong>1. Perl<br />
</strong><br />
<code>print "Hello, World!";</code></p>
<p><strong>2. Python<br />
</strong><br />
<code>print('Hello, World!')</code></p>
<p><strong>3. PHP<br />
</strong><br />
<code>echo "Hello, World!";</code></p>
<p><strong>4. Ruby<br />
</strong><br />
<code>puts "Hello, World!"</code></p>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/multi-line-string-in-ruby' rel='bookmark' title='Multi-line string in Ruby'>Multi-line string in Ruby</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-perform-syntax-check-for-python-program' rel='bookmark' title='How to perform syntax check for Python program'>How to perform syntax check for Python program</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-modify-a-single-character-in-a-string-in-python' rel='bookmark' title='How to modify a single character in a string in Python?'>How to modify a single character in a string in Python?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Perl strict mode to restrict unsafe constructs</title>
		<link>http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs</link>
		<comments>http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs#comments</comments>
		<pubDate>Mon, 26 Sep 2011 10:33:56 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3524</guid>
		<description><![CDATA[Enable Perl strict mode to restrict unsafe constructs Answer: In Perl, you can enforce using the strict mode to reduce the chance of nasty error, e.g. $foo = 'bar'; print $foo; If you run the above problem, it is completely valid. # perl test.pl bar However, if you use the strict pragma use strict; $foo <a href='http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/run-perl-with-useful-warnings' rel='bookmark' title='Run Perl with useful warnings'>Run Perl with useful warnings</a></li>
<li><a href='http://www.linuxask.com/questions/read-command-line-arguments-in-perl' rel='bookmark' title='Read command line arguments in Perl'>Read command line arguments in Perl</a></li>
<li><a href='http://www.linuxask.com/questions/wide-character-in-print-warning-in-perl' rel='bookmark' title='Wide character in print&#8230; warning in Perl'>Wide character in print&#8230; warning in Perl</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Enable Perl strict mode to restrict unsafe constructs</p>
<p><strong>Answer:</strong></p>
<p>In <strong>Perl</strong>, you can enforce using the <strong>strict </strong>mode to reduce the chance of nasty error, e.g.</p>
<pre><code>$foo = 'bar';
print $foo;</code></pre>
<p>If you run the above problem, it is completely valid.</p>
<pre><code># perl test.pl
bar
</code></pre>
<p>However, if you use the <strong>strict </strong>pragma</p>
<pre><code>use strict;

$foo = 'bar';
print $foo;</code></pre>
<p>And run the program again..</p>
<pre><code># perl test.pl
Global symbol "$foo" requires explicit package name at test.pl line 3.
Global symbol "$foo" requires explicit package name at test.pl line 4.
Execution of test.pl aborted due to compilation errors.</code></pre>
<p>Since the <strong>$foo</strong> is not declared before the first use, so the compilation stopped. In modern Perl developements, it is recommended to alwasys use the <strong>strict </strong>pragma in order to write a better and maintainable program.</p>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/run-perl-with-useful-warnings' rel='bookmark' title='Run Perl with useful warnings'>Run Perl with useful warnings</a></li>
<li><a href='http://www.linuxask.com/questions/read-command-line-arguments-in-perl' rel='bookmark' title='Read command line arguments in Perl'>Read command line arguments in Perl</a></li>
<li><a href='http://www.linuxask.com/questions/wide-character-in-print-warning-in-perl' rel='bookmark' title='Wide character in print&#8230; warning in Perl'>Wide character in print&#8230; warning in Perl</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install a NodeJS module using npm globally</title>
		<link>http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally</link>
		<comments>http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally#comments</comments>
		<pubDate>Thu, 22 Sep 2011 14:50:59 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[nodejs]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3509</guid>
		<description><![CDATA[How to install a NodeJS module using npm globally Answer: By default, node modules installed using simple node install will be installed under the folder ./node_modules. In order to install the modules globally, try # sudo npm install express -g The above command install the express module as global module. Related posts: Install NodeJS in <a href='http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/install-nodejs-in-linux' rel='bookmark' title='Install NodeJS in Linux'>Install NodeJS in Linux</a></li>
<li><a href='http://www.linuxask.com/questions/install-perl-module-using-cpan' rel='bookmark' title='Install Perl module using CPAN'>Install Perl module using CPAN</a></li>
<li><a href='http://www.linuxask.com/questions/install-perl-module-from-cpan-even-tests-failed' rel='bookmark' title='Install Perl module from CPAN even tests failed'>Install Perl module from CPAN even tests failed</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>How to install a NodeJS module using npm globally</p>
<p><strong>Answer:</strong></p>
<p>By default, node modules installed using simple <b>node install</b> will be installed under the folder <strong>./node_modules</strong>. In order to install the modules globally, try </p>
<pre><code># sudo npm install express -g</code></pre>
<p>The above command install the <a href="http://expressjs.com/">express </a>module as global module.</p>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/install-nodejs-in-linux' rel='bookmark' title='Install NodeJS in Linux'>Install NodeJS in Linux</a></li>
<li><a href='http://www.linuxask.com/questions/install-perl-module-using-cpan' rel='bookmark' title='Install Perl module using CPAN'>Install Perl module using CPAN</a></li>
<li><a href='http://www.linuxask.com/questions/install-perl-module-from-cpan-even-tests-failed' rel='bookmark' title='Install Perl module from CPAN even tests failed'>Install Perl module from CPAN even tests failed</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install the node package manager (npm)</title>
		<link>http://www.linuxask.com/questions/install-the-node-package-manager-npm</link>
		<comments>http://www.linuxask.com/questions/install-the-node-package-manager-npm#comments</comments>
		<pubDate>Tue, 20 Sep 2011 14:48:38 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[nodejs]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3507</guid>
		<description><![CDATA[Install the node package manager (npm) Answer: npm is a package manager for node.js, to install it under Linux, just a single command: # curl http://npmjs.org/install.sh &#124; sudo sh Related posts: Install NodeJS in Linux How to install a NodeJS module using npm globally Displays information about package in Ubuntu
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/install-nodejs-in-linux' rel='bookmark' title='Install NodeJS in Linux'>Install NodeJS in Linux</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally' rel='bookmark' title='How to install a NodeJS module using npm globally'>How to install a NodeJS module using npm globally</a></li>
<li><a href='http://www.linuxask.com/questions/displays-information-about-package-in-ubuntu' rel='bookmark' title='Displays information about package in Ubuntu'>Displays information about package in Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Install the node package manager (npm)</p>
<p><strong>Answer:</strong></p>
<p><strong>npm </strong>is a package manager for <strong>node.js</strong>, to install it under Linux, just a single command:</p>
<p><code># curl http://npmjs.org/install.sh | sudo sh</code></p>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/install-nodejs-in-linux' rel='bookmark' title='Install NodeJS in Linux'>Install NodeJS in Linux</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally' rel='bookmark' title='How to install a NodeJS module using npm globally'>How to install a NodeJS module using npm globally</a></li>
<li><a href='http://www.linuxask.com/questions/displays-information-about-package-in-ubuntu' rel='bookmark' title='Displays information about package in Ubuntu'>Displays information about package in Ubuntu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/install-the-node-package-manager-npm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install NodeJS in Linux</title>
		<link>http://www.linuxask.com/questions/install-nodejs-in-linux</link>
		<comments>http://www.linuxask.com/questions/install-nodejs-in-linux#comments</comments>
		<pubDate>Wed, 14 Sep 2011 15:16:01 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[nodejs]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3515</guid>
		<description><![CDATA[Install NodeJS in Linux Answer: In order to install NodeJS in Linux, the recommended way is compile from source and install it. # wget http://nodejs.org/dist/node-v0.4.11.tar.gz # tar zxf node-v0.4.11.tar.gz # cd node-v0.4.11 # ./configure # sudo make &#038;&#038; make install Now you can type node to enter the node's REPL Related posts: How to install <a href='http://www.linuxask.com/questions/install-nodejs-in-linux'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally' rel='bookmark' title='How to install a NodeJS module using npm globally'>How to install a NodeJS module using npm globally</a></li>
<li><a href='http://www.linuxask.com/questions/install-the-node-package-manager-npm' rel='bookmark' title='Install the node package manager (npm)'>Install the node package manager (npm)</a></li>
<li><a href='http://www.linuxask.com/questions/install-gd-library-for-php-on-linux' rel='bookmark' title='Install GD Library for PHP on Linux'>Install GD Library for PHP on Linux</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Install NodeJS in Linux</p>
<p><strong>Answer:</strong></p>
<p>In order to install <strong>NodeJS </strong>in Linux, the recommended way is compile from source and install it.</p>
<pre><code># wget http://nodejs.org/dist/node-v0.4.11.tar.gz
# tar zxf node-v0.4.11.tar.gz
# cd node-v0.4.11
# ./configure
# sudo make &#038;& make install</code></pre>
<p>Now you can type <strong>node </strong>to enter the node's <a href="http://nodejs.org/docs/latest/api/repl.html">REPL </a></p>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/how-to-install-a-nodejs-module-using-npm-globally' rel='bookmark' title='How to install a NodeJS module using npm globally'>How to install a NodeJS module using npm globally</a></li>
<li><a href='http://www.linuxask.com/questions/install-the-node-package-manager-npm' rel='bookmark' title='Install the node package manager (npm)'>Install the node package manager (npm)</a></li>
<li><a href='http://www.linuxask.com/questions/install-gd-library-for-php-on-linux' rel='bookmark' title='Install GD Library for PHP on Linux'>Install GD Library for PHP on Linux</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/install-nodejs-in-linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to remove object from array inside foreach loop?</title>
		<link>http://www.linuxask.com/questions/how-to-remove-object-from-array-inside-foreach-loop</link>
		<comments>http://www.linuxask.com/questions/how-to-remove-object-from-array-inside-foreach-loop#comments</comments>
		<pubDate>Mon, 12 Sep 2011 07:16:34 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3478</guid>
		<description><![CDATA[How to remove object from array inside foreach loop? Answer: In PHP, to remove object (e.g. with the key = foo in the following example) from array inside foreach loop, you can try: &#60;?php foreach($array as $key=> $value) { if ($key == "foo") { unset($array[$key]); } } Related posts: Convert array to object in PHP <a href='http://www.linuxask.com/questions/how-to-remove-object-from-array-inside-foreach-loop'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/convert-array-to-object-in-php' rel='bookmark' title='Convert array to object in PHP'>Convert array to object in PHP</a></li>
<li><a href='http://www.linuxask.com/questions/clone-an-object-in-php' rel='bookmark' title='Clone an object in PHP'>Clone an object in PHP</a></li>
<li><a href='http://www.linuxask.com/questions/create-an-array-containing-a-range-of-elements-in-php' rel='bookmark' title='Create an array containing a range of elements in PHP'>Create an array containing a range of elements in PHP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>How to remove object from array inside foreach loop?</p>
<p><strong>Answer:</strong></p>
<p>In PHP, to remove object (e.g. with the key = <strong>foo </strong>in the following example) from array inside foreach loop, you can try:</p>
<pre><code>&lt;?php

foreach($array as $key=> $value) {
    if ($key == "foo") {
        unset($array[$key]);
    }
}</code></pre>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/convert-array-to-object-in-php' rel='bookmark' title='Convert array to object in PHP'>Convert array to object in PHP</a></li>
<li><a href='http://www.linuxask.com/questions/clone-an-object-in-php' rel='bookmark' title='Clone an object in PHP'>Clone an object in PHP</a></li>
<li><a href='http://www.linuxask.com/questions/create-an-array-containing-a-range-of-elements-in-php' rel='bookmark' title='Create an array containing a range of elements in PHP'>Create an array containing a range of elements in PHP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-to-remove-object-from-array-inside-foreach-loop/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if a file exist in Bash Shell</title>
		<link>http://www.linuxask.com/questions/check-if-a-file-exist-in-bash-shell</link>
		<comments>http://www.linuxask.com/questions/check-if-a-file-exist-in-bash-shell#comments</comments>
		<pubDate>Tue, 23 Aug 2011 13:44:55 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3405</guid>
		<description><![CDATA[Check if a file exist in Bash Shell Answer: The following script demonstrates how to check if a file exist, using shell (Bash) script #!/bin/bash if [ -e test.txt ] then echo 'The file exists.' else echo 'The file does not exist.' fi Related posts: How to check the bash shell version How to perform <a href='http://www.linuxask.com/questions/check-if-a-file-exist-in-bash-shell'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/how-to-check-the-bash-shell-version' rel='bookmark' title='How to check the bash shell version'>How to check the bash shell version</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-perform-syntax-check-on-a-bash-script' rel='bookmark' title='How to perform syntax check on a bash script?'>How to perform syntax check on a bash script?</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-get-the-pid-in-current-bash-shell-script' rel='bookmark' title='How to get the PID in current bash shell script'>How to get the PID in current bash shell script</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Check if a file exist in Bash Shell</p>
<p><strong>Answer:</strong></p>
<p>The following script demonstrates how to check if a file exist, using shell (<strong>Bash</strong>) script </p>
<pre><code>#!/bin/bash

if [ -e test.txt ]
then
  echo 'The file exists.'
else
  echo 'The file does not exist.'
fi
</code></pre>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/how-to-check-the-bash-shell-version' rel='bookmark' title='How to check the bash shell version'>How to check the bash shell version</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-perform-syntax-check-on-a-bash-script' rel='bookmark' title='How to perform syntax check on a bash script?'>How to perform syntax check on a bash script?</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-get-the-pid-in-current-bash-shell-script' rel='bookmark' title='How to get the PID in current bash shell script'>How to get the PID in current bash shell script</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/check-if-a-file-exist-in-bash-shell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate IP address in PHP</title>
		<link>http://www.linuxask.com/questions/validate-ip-address-in-php</link>
		<comments>http://www.linuxask.com/questions/validate-ip-address-in-php#comments</comments>
		<pubDate>Fri, 05 Aug 2011 15:39:53 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3228</guid>
		<description><![CDATA[Validate IP address in PHP Answer: If you are using PHP 5.2 or above (in fact, at the moment of writing, you should use at least PHP 5.3+), you can use the following easy method: if(filter_var($ip, FILTER_VALIDATE_IP)) { // Valid IP } else { // Invalid IP } Related posts: Validate email address using PHP <a href='http://www.linuxask.com/questions/validate-ip-address-in-php'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/validate-email-address-using-php' rel='bookmark' title='Validate email address using PHP'>Validate email address using PHP</a></li>
<li><a href='http://www.linuxask.com/questions/what-is-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1' rel='bookmark' title='What is the difference between ip address 0.0.0.0 and 127.0.0.1?'>What is the difference between ip address 0.0.0.0 and 127.0.0.1?</a></li>
<li><a href='http://www.linuxask.com/questions/block-a-remote-ip-address-using-iptables' rel='bookmark' title='Block a remote IP Address using iptables'>Block a remote IP Address using iptables</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Validate IP address in PHP</p>
<p><strong>Answer:</strong></p>
<p>If you are using <strong>PHP 5.2</strong> or above (in fact, at the moment of writing, you should use at least PHP 5.3+), you can use the following easy method:</p>
<pre><code>if(filter_var($ip, FILTER_VALIDATE_IP))
{
  // Valid IP
}
else
{
  // Invalid IP
}</code></pre>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/validate-email-address-using-php' rel='bookmark' title='Validate email address using PHP'>Validate email address using PHP</a></li>
<li><a href='http://www.linuxask.com/questions/what-is-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1' rel='bookmark' title='What is the difference between ip address 0.0.0.0 and 127.0.0.1?'>What is the difference between ip address 0.0.0.0 and 127.0.0.1?</a></li>
<li><a href='http://www.linuxask.com/questions/block-a-remote-ip-address-using-iptables' rel='bookmark' title='Block a remote IP Address using iptables'>Block a remote IP Address using iptables</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/validate-ip-address-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the current PHP include path&#8217;s setting</title>
		<link>http://www.linuxask.com/questions/get-the-current-php-include-paths-setting</link>
		<comments>http://www.linuxask.com/questions/get-the-current-php-include-paths-setting#comments</comments>
		<pubDate>Mon, 01 Aug 2011 15:24:50 +0000</pubDate>
		<dc:creator>Linux Ask!</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3224</guid>
		<description><![CDATA[Get the current PHP include path's setting Answer: To get the current PHP include path's setting, you can use the function get_include_path E.g. echo get_include_path(); Usually it is used with the set_include_path for adding extra path to the existing include_path, E.g. set_include_path(get_include_path() . PATH_SEPARATOR . "/data/path"); Related posts: What is the difference between include() and <a href='http://www.linuxask.com/questions/get-the-current-php-include-paths-setting'>[...]</a>
Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/what-is-the-difference-between-include-and-require-in-php' rel='bookmark' title='What is the difference between include() and require() in PHP?'>What is the difference between include() and require() in PHP?</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-execute-prorgam-in-the-current-directory' rel='bookmark' title='How to execute prorgam in the current directory'>How to execute prorgam in the current directory</a></li>
<li><a href='http://www.linuxask.com/questions/list-the-size-of-sub-directories-in-the-current-directory' rel='bookmark' title='List the size of sub directories in the current directory'>List the size of sub directories in the current directory</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Get the current PHP include path's setting</p>
<p><strong>Answer:</strong></p>
<p>To get the current PHP include path's setting, you can use the function <strong>get_include_path </strong></p>
<p>E.g.</p>
<pre><code>echo get_include_path();</code></pre>
<p>Usually it is used with the <strong>set_include_path</strong> for adding extra path to the existing include_path,</p>
<p>E.g.</p>
<pre><code>set_include_path(get_include_path() . PATH_SEPARATOR . "/data/path");</code></pre>
<p>Related posts:<ol>
<li><a href='http://www.linuxask.com/questions/what-is-the-difference-between-include-and-require-in-php' rel='bookmark' title='What is the difference between include() and require() in PHP?'>What is the difference between include() and require() in PHP?</a></li>
<li><a href='http://www.linuxask.com/questions/how-to-execute-prorgam-in-the-current-directory' rel='bookmark' title='How to execute prorgam in the current directory'>How to execute prorgam in the current directory</a></li>
<li><a href='http://www.linuxask.com/questions/list-the-size-of-sub-directories-in-the-current-directory' rel='bookmark' title='List the size of sub directories in the current directory'>List the size of sub directories in the current directory</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/get-the-current-php-include-paths-setting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

