<?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>Samet Kilictas&#039;s Blog</title>
	<atom:link href="http://samet.kilictas.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://samet.kilictas.com</link>
	<description>J2E, PHP, Linux, PL/SQL and other random rants</description>
	<lastBuildDate>Fri, 06 Apr 2012 06:25:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Web 3.0 Concepts Explanation</title>
		<link>http://samet.kilictas.com/web-3-0-concepts-explanation/</link>
		<comments>http://samet.kilictas.com/web-3-0-concepts-explanation/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 04:36:58 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[semantic]]></category>
		<category><![CDATA[web3.0]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=531</guid>
		<description><![CDATA[Web 1.0 &#8211; That Geocities &#38; Hotmail era was all about read-only content and static HTML websites. People preferred navigating the web through link directories of Yahoo! and dmoz. Web 2.0 &#8211; This is about user-generated content and the read-write web. People are consuming as well as contributing information through blogs or sites like Flickr, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://samet.kilictas.com/wp-content/uploads/2011/11/webevolution.png"><img class="alignnone size-full wp-image-532" title="webevolution" src="http://samet.kilictas.com/wp-content/uploads/2011/11/webevolution.png" alt="" width="535" height="303" /></a></p>
<p><strong>Web 1.0</strong> &#8211; That Geocities &amp; Hotmail era was all about read-only content and static HTML websites. People preferred navigating the web through link directories of Yahoo! and dmoz.</p>
<p><strong>Web 2.0</strong> &#8211; This is about user-generated content and the read-write web. People are consuming as well as contributing information through blogs or sites like Flickr, YouTube, Digg, etc. The line dividing a consumer and content publisher is increasingly getting blurred in the Web 2.0 era.</p>
<p><strong>Web 3.0</strong> &#8211; This will be about semantic web (or the meaning of data), personalization (e.g. iGoogle), intelligent search and behavioral advertising among other things.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D531&count=vertical&related=&text=Web%203.0%20Concepts%20Explanation' class='twitter-share-button' data-text='Web 3.0 Concepts Explanation' data-url='http://samet.kilictas.com/?p=531' data-counturl='http://samet.kilictas.com/web-3-0-concepts-explanation/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/web-3-0-concepts-explanation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actual size of tables for tablespaces</title>
		<link>http://samet.kilictas.com/actual-size-of-tables-for-tablespaces/</link>
		<comments>http://samet.kilictas.com/actual-size-of-tables-for-tablespaces/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 15:05:20 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[oracle table size]]></category>
		<category><![CDATA[segment]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[table size]]></category>
		<category><![CDATA[tablespace]]></category>
		<category><![CDATA[user_segments]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=522</guid>
		<description><![CDATA[The size of a table can be found using oracle&#8217;s segment tables. Basically following code block returns a result of table size within related tablespaces in terms of MB and GB: SELECT tablespace_name, segment_name AS TABLENAME, trunc((sum(BYTES) / 1024 / 1024), 2) MB, trunc((sum(BYTES) / 1024 / 1024 / 1024), 2) GB FROM user_segments GROUP [...]]]></description>
			<content:encoded><![CDATA[<p>The size of a table can be found using oracle&#8217;s segment tables. Basically following code block returns a result of table size within related tablespaces in terms of MB and GB:</p>
<pre class="brush: sql">
   SELECT tablespace_name,
          segment_name AS TABLENAME,
          trunc((sum(BYTES) / 1024 / 1024), 2) MB,
          trunc((sum(BYTES) / 1024 / 1024 / 1024), 2) GB
     FROM user_segments
 GROUP BY tablespace_name, segment_name
</pre>
<p>This way you may access only the tablespaces of logged in user</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D522&count=vertical&related=&text=Actual%20size%20of%20tables%20for%20tablespaces' class='twitter-share-button' data-text='Actual size of tables for tablespaces' data-url='http://samet.kilictas.com/?p=522' data-counturl='http://samet.kilictas.com/actual-size-of-tables-for-tablespaces/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/actual-size-of-tables-for-tablespaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8216;O Sole Mio</title>
		<link>http://samet.kilictas.com/o-sole-mio/</link>
		<comments>http://samet.kilictas.com/o-sole-mio/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 04:39:48 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Me]]></category>
		<category><![CDATA[güneş]]></category>
		<category><![CDATA[güneşli günler]]></category>
		<category><![CDATA[ne güzel güneşli bir gün]]></category>
		<category><![CDATA[o sole mio]]></category>
		<category><![CDATA[song]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=501</guid>
		<description><![CDATA[Orijinal (Napoliten) Türkçe Çeviri Che bella cosa e&#8217; na jurnata &#8216;e sole, n&#8217;aria serena doppo na tempesta! Pe&#8217; ll&#8217;aria fresca pare già na festa Che bella cosa e&#8217; na jurnata &#8216;e sole Ma n&#8217;atu sole, cchiù bello, oje ne&#8217; &#8216;O sole mio sta &#8216;nfronte a te! &#8216;O sole, &#8216;o sole mio sta &#8216;nfronte a te! [...]]]></description>
			<content:encoded><![CDATA[<p><center><iframe src="http://www.youtube.com/embed/u1QJwHWvgP8?rel=0" frameborder="0" width="420" height="315"></iframe></center></p>
<table border="0">
<thead>
<th>Orijinal (Napoliten)</th>
<th>Türkçe Çeviri</th>
</thead>
<tbody>
<tr>
<td width='50%'>Che bella cosa e&#8217; na jurnata &#8216;e sole,<br />
n&#8217;aria serena doppo na tempesta!<br />
Pe&#8217; ll&#8217;aria fresca pare già na festa<br />
Che bella cosa e&#8217; na jurnata &#8216;e sole</p>
<p>Ma n&#8217;atu sole,<br />
cchiù bello, oje ne&#8217;<br />
&#8216;O sole mio<br />
sta &#8216;nfronte a te!<br />
&#8216;O sole, &#8216;o sole mio<br />
sta &#8216;nfronte a te!<br />
sta &#8216;nfronte a te!</p>
<p>Quanno fa notte e &#8216;o sole se ne scenne,<br />
me vene quase &#8216;na malincunia;<br />
sotto &#8216;a fenesta toia restarria<br />
quanno fa notte e &#8216;o sole se ne scenne.</p>
<p>Ma n&#8217;atu sole,<br />
cchiù bello, oje ne&#8217;<br />
&#8216;O sole mio<br />
sta &#8216;nfronte a te!<br />
&#8216;O sole, &#8216;o sole mio<br />
sta &#8216;nfronte a te!<br />
sta &#8216;nfronte a te!</td>
<td width='50%'>Ne güzel bir şeydir, güneşli bir gün,<br />
Hava nasıl da durgun fırtınadan sonra<br />
Öylesine taze ki hava, sanki şimdiden bayram gelmiş<br />
Ne güzel bir şeydir, güneşli bir gün,</p>
<p>Ama baska bir güneş var ki<br />
Çok daha görkemli ve ışıltılı,<br />
O da senin yüzünde doğan<br />
Benim güneşim<br />
Benim kendi güneşim<br />
Senin çehrende<br />
Senin simanda</p>
<p>Gece olunca ve güneş batınca<br />
Bana öylesine bir kasvet çöker<br />
Evinin penceresinin altında otursam<br />
Gece olunca ve güneş batınca.</p>
<p>Ama baska bir güneş var ki<br />
Çok daha görkemli ve ışıltılı,<br />
O da senin yüzünde doğan<br />
Benim güneşim<br />
Benim kendi güneşim<br />
Senin çehrende<br />
Senin simanda</td>
</tr>
</tbody>
</table>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D501&count=vertical&related=&text=%26%23039%3BO%20Sole%20Mio' class='twitter-share-button' data-text='&#039;O Sole Mio' data-url='http://samet.kilictas.com/?p=501' data-counturl='http://samet.kilictas.com/o-sole-mio/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/o-sole-mio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Laptop sound problem, headphones working, built in speaker not working</title>
		<link>http://samet.kilictas.com/laptop-sound-problem-headphones-working-built-in-speaker-not-working/</link>
		<comments>http://samet.kilictas.com/laptop-sound-problem-headphones-working-built-in-speaker-not-working/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 09:25:23 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[headphone]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[sound]]></category>
		<category><![CDATA[speaker]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=497</guid>
		<description><![CDATA[Laptop sound problem, headphones working, built in speaker not working ]]></description>
			<content:encoded><![CDATA[<p>Yesterday, i just restarted my laptop and built-in speakers stopped working but headphones. I have re-installed drivers but didnt worked. So i tought it is some hardware problem related with soundcard. Then i got a sound from speakers for a second while unpluging my headhone jack from the port. I have plugged and unplugged the headphone jack couple of times and it worked. Problem was some kind of short in jack port.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D497&count=vertical&related=&text=Laptop%20sound%20problem%2C%20headphones%20working%2C%20built%20in%20speaker%20not%20working%20' class='twitter-share-button' data-text='Laptop sound problem, headphones working, built in speaker not working ' data-url='http://samet.kilictas.com/?p=497' data-counturl='http://samet.kilictas.com/laptop-sound-problem-headphones-working-built-in-speaker-not-working/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/laptop-sound-problem-headphones-working-built-in-speaker-not-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manage your virtual hosts on apache server easily</title>
		<link>http://samet.kilictas.com/manage-your-virtual-hosts-on-apache-server-easily/</link>
		<comments>http://samet.kilictas.com/manage-your-virtual-hosts-on-apache-server-easily/#comments</comments>
		<pubDate>Sat, 28 May 2011 16:07:10 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[virtual host]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=445</guid>
		<description><![CDATA[Building up and making all modifications on your server is pretty boring. There is no need to find the sun again and again. I’ve had to go through the process of reconfiguring my virtual hosts for Apache2 several times and i found a pre modified shell script and modified the script according to my needs. [...]]]></description>
			<content:encoded><![CDATA[<p>Building up and making all modifications on your server is pretty boring. There is no need to find the sun again and again. I’ve had to go through the process of reconfiguring my virtual hosts for Apache2 several times and i found a pre modified shell script and modified the script according to my needs. This script enables you to create, destroy your virtual host in a second.</p>
<p>you can download the script from here : <a href="http://samet.kilictas.com/wp-content/uploads/2011/05/vhost.txt">vhost.txt</a> or;</p>
<pre class="brush: sh">mkdir ~/bin
cd ~/bin
wget http://samet.kilictas.com/wp-content/uploads/2011/05/vhost.txt
mv vhost.txt vhost
chmod 755 vhost</pre>
<p>Now, to invoke the script, type the following:</p>
<pre class="brush: sh">. ~/bin/vhost</pre>
<p>By using this script you can create, destroy a virtual host. In order to create a new host on your server user following command by replacing appreciate values:</p>
<pre class="brush: sql">vhost create &lt;domain&gt; &lt;admin-email&gt; &lt;host-ip&gt;</pre>
<p>The script creates required directories,files as shown below;</p>
<p><strong>Web directories</strong><br />
<em>/www/htdocs/$domain</em><br />
<strong> </strong></p>
<p><strong>Web cgi-bin</strong><br />
<em>/www/cgi-bin/$domain</em></p>
<p><strong>Web logs</strong><br />
<em>/www/logs/$domain/apache2</em><br />
<em> /www/logs/$domain/apache2/access.log</em><br />
<em> /www/logs/$domain/apache2/error.log</em></p>
<p>then builds virtual host config file and enables it right away (enabling is optional), which is placed in following directory</p>
<p><em>/etc/apache2/sites-available/$domain</em></p>
<p>After getting done with all these process it simply creates a little info file</p>
<p><em>/www/$domain/logs/site_info</em></p>
<p>Great you have created and enabled your virtual host, you may need to destroy a virtual host, here is how;</p>
<pre class="brush: sql">vhost destroy &lt;domain&gt;</pre>
<p><span id="more-445"></span></p>
<p>get some help with;</p>
<pre class="brush: sql">vhost help</pre>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D445&count=vertical&related=&text=Manage%20your%20virtual%20hosts%20on%20apache%20server%20easily' class='twitter-share-button' data-text='Manage your virtual hosts on apache server easily' data-url='http://samet.kilictas.com/?p=445' data-counturl='http://samet.kilictas.com/manage-your-virtual-hosts-on-apache-server-easily/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/manage-your-virtual-hosts-on-apache-server-easily/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Shell Scripting Tutorial</title>
		<link>http://samet.kilictas.com/bash-shell-scripting-tutorial/</link>
		<comments>http://samet.kilictas.com/bash-shell-scripting-tutorial/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 07:19:24 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=420</guid>
		<description><![CDATA[Basics This tutorial assumes that you already know how to log in to your UNIX machine, bring up the bash shell, and run basic commands such as ls and cat. Getting to this point is fairly easy, but unfortunately this is the level that most users stay at indefinitely. This tutorial is intended to help [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Basics</strong><br />
This tutorial assumes that you already know how to log in to your UNIX machine, bring up the bash shell, and run basic commands such as ls and cat. Getting to this point is fairly easy, but unfortunately this is the level that most users stay at indefinitely. This tutorial is intended to help you start to learn the more advanced features of using a shell, and specifically bash, one of the most powerful shells available.</p>
<p>Please note that most of the command themselves are not explained; you can examine their functionality yourself by either reading their man page, or just experimenting with them to see what they do.</p>
<p><strong>Redirection</strong><br />
Normally programs take input from our keyboard, and display the output to our screens. However, these are just the defaults &#8211; UNIX has the ability to redirect the input (commonly referred to as stdin, short for standard input) and output (commonly referred to as stdout, short for standard output).<br />
<span id="more-420"></span><br />
Here is a simple example: the cat command displays the contents of a file to the screen. But we can redirect those contents to a file using the redirection operator &#8216;&gt;&#8217;, like so:</p>
<pre class="brush: bash">
$ cat myfile.txt
This is the contents of the file myfile.txt
$ cat myfile.txt &gt; newfile.txt
$ cat newfile.txt
This is the contents of the file myfile.txt
$
</pre>
<p>In effect, we&#8217;ve made cat do the same thing as cp, by redirecting the output from the screen to a file. This isn&#8217;t terribly useful, but consider another, similar, scenario: cat can take multiple arguments, and it will display the files one after the other. This can be used to append one file onto another and create a new, combined file.</p>
<pre class="brush: bash">
$ cat file1.txt
The quick brown fox...
$ cat file2.txt
...jumped over the lazy dog.
$ cat file1.txt file2.txt &gt; combined.txt
$ cat combined.txt
The quick brown fox...
...jumped over the lazy dog.
</pre>
<p>Neat, eh?</p>
<p>We can also redirect the input, so that a program takes the contents of a file as if it were typed at your keyboard. cat doesn&#8217;t take any input, so let&#8217;s use bc, a command line calculator. Normally, you run the program, and it lets you type in calculations such as &#8220;2+2&#8243;, and then displays the result. But if you have a file which already contains the calculations, you can send it straight to bc &#8211; faster and more powerful than cutting-and-pasting the text in with your mouse.</p>
<pre class="brush: bash">
$ cat calc.txt
2+2
$ bc &lt; calc.txt 4 $ </pre>
<p> A final note: you can use two output redirect symbols together &#8211; &gt;&gt; &#8211; to indicate that you want to append the file, not overwrite it. Hence:</p>
<pre class="brush: bash">
$ cat file1.txt
Contents of file1.
$ cat file2.txt
Contents of file2.txt.
$ cat file2.txt &gt;&gt; file1.txt
$ cat file1.txt
Contents of file1.
Contents of file2.txt.
$
</pre>
<p><strong>Pipes</strong><br />
Pipes are similar to redirection, but they are even more powerful, because they allow you to send input and output back and forth between programs. For example, let&#8217;s say that you want to send the calculation &#8220;2+2&#8243; to bc in a single command, without creating a file for redirection, or firing up bc and then entering the calculation. You can use the command echo, which normally sends output to the screen:</p>
<pre class="brush: bash">
$ echo 2+2
2+2
$
</pre>
<p>But instead we can send it through a pipe using the pipe character &#8216;|&#8217;, which you create by typing shift-backslash on your keyboard.</p>
<pre class="brush: bash">
$ echo 2+2 | bc
4
$
</pre>
<p>One thing that may throw you off about this example is that it seems intuitively out of order; bc is the &#8220;important&#8221; program being run, and normally we would expect that to come first. But it doesn&#8217;t, and for good reason: the pipeline works by sending the output of each successive program to the one immediately to its right. In this case, echo has to run first, because it generates the text &#8220;2+2&#8243; and stuffs it into the pipe. bc then receives the &#8220;2+2&#8243; text, and does its thing, which is process the calculation.</p>
<p>Possibly one of the most immediately useful features of the UNIX command line is the ability to fire off an email instantaneously using the mail command.</p>
<pre class="brush: bash">
$ echo &quot;Hey, I sent this mail from the bash command line!&quot; | mail -s &quot;bash rocks&quot; user@host.com
</pre>
<p><strong>Combinations</strong><br />
The true power of UNIX shells, and especially bash, is reflected in your ability to mix and match redirection, pipes, and other operators almost limitlessly. Here&#8217;s a combination example: we send 2+2 through the pipe, which bc calculates, and then sends the output to a file.</p>
<pre class="brush: bash">
$ echo 2+2 | bc &gt; result.txt
$ cat result.txt
4
$
</pre>
<p><strong>Variables</strong><br />
Variables are values that you give a name. They are significant because you can call them by that name throughout your bash &#8220;code&#8221;, but it can contain different values at different times. A simpler way to think about them is that they are simply storage containers, for keeping data around that you will later use within bash.</p>
<p>Here is an example of assigning a value, and then displaying its contents:</p>
<pre class="brush: bash">
$ MYVAR=3
$ echo $MYVAR
3
$
</pre>
<p>When the variable is first assigned (and created), the $ symbol is not used. From that point forward, however, it must be prefixed with the $ symbol or it will not be properly recognized by bash.</p>
<p>Variables can contain text, numbers, lists &#8211; just about anything that you can think of. There is no &#8220;type casting&#8221; as in structured programming languages, so you need not keep track of what sort of data is stored where.</p>
<p>It&#8217;s possible to do basic math with variables, like so:</p>
<pre class="brush: bash">
$ A=2
$ B=3
$ C=$((A+B))
$ echo $C
5
</pre>
<p>A simple use for variables is to save some data temporarily that you&#8217;re going to use in a later command, possibly several commands. In this example, we&#8217;ll get a list of files, print each one, append them to a master file, and then delete them.</p>
<pre class="brush: bash">
$ FILES=*.txt
$ lpr $FILES
$ cat $FILES &gt;&gt; master.txt
$ rm $FILES
</pre>
<p>So far variables might not seem terribly useful. In fact, their power doesn&#8217;t become obvious until we start using constructs such as loops.</p>
<p><strong>Loops</strong><br />
Computers are excellent at repetitious tasks. Yet all too often, because of limited user interfaces (especially the GUI interfaces that are the most popular), computer users find themselves doing mindless tasks, such as renaming a long list of files. This is a task that is ideal for an iterative loop. It is &#8220;iterative&#8221; because we step through each item in a list, doing a similar operation on each one. The two main types of loops are for loops and while loops, but let&#8217;s focus on for loops as they are generally more useful at the command line.</p>
<p>The format of the for loop command is as follows:</p>
<p>for counter in list; do command; done</p>
<p>Everything in italics are items you need to replace with your own values. Counter is the name of the variable you want to use to count with; it can be any single word. List is a list of items, one after the other, that you wish to step through, one by one. And command is what you actually want to do to each one. Since an example is worth a thousand words, take a look:</p>
<pre class="brush: bash">
$ for i in 1 2 3; do echo Loop iteration: $i; done
Loop iteration: 1
Loop iteration: 2
Loop iteration: 3
$
</pre>
<p>The counter variable is called &#8220;i&#8221;, and you may note that when referring to it in places other than right after the for we place a $ character in front of its name, so it becomes $i.</p>
<p>The list is 1, 2, and 3. List items should be separated by spaces.</p>
<p>The command is &#8220;echo Loop iteration: $i&#8221;. This command gets run for each member of the list; and the counter variable ($i) gets replaced with the current list member we are executing on each time we step through it. Thus, the first time it prints &#8220;Loop iteration: 1&#8243; because the value of $i is 1.</p>
<p>One neat trick we can use is to use wildcard characters (* and ?) in order to loop through files in the current directory. As a simple example, we could simply print each filename, duplicating the effect of the command ls:</p>
<pre class="brush: bash">
$ ls
file1.txt file2.txt
$ for i in *; do echo $i; done
file1.txt
file2.txt
$
</pre>
<p>That&#8217;s not so useful, but let&#8217;s say that we want to rename each file to start with the word &#8220;my&#8221;.</p>
<pre class="brush: bash">
$ ls
file1.txt file2.txt
$ for i in *; do mv $i my-$i; done
$ ls
myfile1.txt myfile2.txt
$
</pre>
<p><strong>Backticks</strong><br />
The magical backticks (the character `) are one of the best kept secrets of shell scripting, but at the same time one of the most useful. They allow you to run a secondary command inside of a new shell, and the output from that command will be placed onto the command line on the spot! As usual, and example shows best.</p>
<pre class="brush: bash">
$ cat masterfile.txt
file1.txt
file2.txt
file3.txt
$ cat `grep -l 2 masterfile.txt`
This is the contents of file 2.
$
</pre>
<p>In this example, the result of the command &#8220;grep -l 2 masterfile.txt&#8221; is going to be &#8220;file2.txt&#8221;. Normally that would just be displayed to the screen, and at that point you could manually type &#8220;cat file2.txt&#8221; to see its contents. But you can do it in a single command with backticks; the output of the grep command (&#8220;file2.txt&#8221;) is substituted on the command line, producing the command &#8220;cat file2.txt&#8221; for you!</p>
<p><strong>Bringing It All Together</strong><br />
At this point, you need to explore these tools yourself in order to get a better understanding of their great flexibility. Provided below are a number of examples to aid in your exploration of these topics.</p>
<p>Converting a list of filenames into lower case</p>
<pre class="brush: bash">
$ for i in *; do mv $i `echo $i | tr A-Z a-z`; done
</pre>
<p>Printing out only files which contain the text &#8220;PrintMe&#8221;</p>
<pre class="brush: bash">
$ lpr `grep -l PrintMe *`
</pre>
<p>Determining the difference in length (number of lines) between two files</p>
<pre class="brush: bash">
$ echo `cat file1.txt | wc -l` - `cat file2.txt | wc -l` | bc
</pre>
<p>Sending mail to a list of email addresses in a file</p>
<pre class="brush: bash">
$ for addr in `cat email-addresses.txt`; do cat message.txt | mail -s &quot;Hi there!&quot; $addr; done
</pre>
<p>Archiving all logfiles to a file named after the current date</p>
<pre class="brush: bash">
$ tar czvf logs-`date +%m%d%y`.tar.gz *.log
</pre>
<p><strong><em>Queued from</em></strong> : <a title="Here" href="http://www.tlc-networks.polito.it/giaccone/corsi/laboratorio/Scripting/Bash/bash.html">Here</a></p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D420&count=vertical&related=&text=Bash%20Shell%20Scripting%20Tutorial' class='twitter-share-button' data-text='Bash Shell Scripting Tutorial' data-url='http://samet.kilictas.com/?p=420' data-counturl='http://samet.kilictas.com/bash-shell-scripting-tutorial/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/bash-shell-scripting-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>if exists syntax in sybase</title>
		<link>http://samet.kilictas.com/if-exists-syntax-in-sybase/</link>
		<comments>http://samet.kilictas.com/if-exists-syntax-in-sybase/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 11:47:00 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[exists]]></category>
		<category><![CDATA[sybase]]></category>
		<category><![CDATA[table exists]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=415</guid>
		<description><![CDATA[Below shows the if exists usage with examples in sybase If exists (select record) begin sql statement 1 sql statement 2 end else begin sql statement 3 sql statement 4 end Example Scripts that include constructs like the following may produce errors if the table described in the script does not include the specified column: [...]]]></description>
			<content:encoded><![CDATA[<p>Below shows the if exists usage with examples in sybase</p>
<blockquote><p>If exists (select record)<br />
begin<br />
sql statement 1<br />
sql statement 2<br />
end<br />
else<br />
begin<br />
sql statement 3<br />
sql statement 4<br />
end</p></blockquote>
<p>Example</p>
<p>Scripts that include constructs like the following may produce errors if the table described in the script does not include the specified column:</p>
<pre class="brush: sql">
if exists (select 1 from syscolumns
where id = object_id(&quot;some_table&quot;)
and name = &quot;some_column&quot;)
begin
alter table some_table drop some_column
end
</pre>
<p>In this example, some_column must exist in some_table for the batch to succeed.</p>
<p>If some_column exists in some_table, the first time you run the batch, alter table drops the column. On subsequent executions, the batch does not compile.</p>
<p>Adaptive Server raises these errors while preprocessing this batch, which are similar to those that are raised when a normal select tries to access a nonexistent column. These errors are raised when you modify a table’s schema using clauses that require a data copy. If you add a null column, and use the above construct, Adaptive Server does not raise these errors.</p>
<p>To avoid such errors when you modify a table’s schema, include alter table in an execute immediate command:</p>
<pre class="brush: sql">
if exists (select 1 from syscolumns
where id = object_id(&quot;some_table&quot;)
and name = &quot;some_column&quot;)
begin
exec (&quot;alter table some_table drop
some_column&quot;)
end
</pre>
<p>Because the execute immediate statement is run only if the if exists() function succeeds, Adaptive Server does not raise any errors when it compiles this script.</p>
<p>You must also use the execute immediate construct for other uses of alter table, for example, to change the locking scheme, and for any other cases when the command does not require data copy.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D415&count=vertical&related=&text=if%20exists%20syntax%20in%20sybase' class='twitter-share-button' data-text='if exists syntax in sybase' data-url='http://samet.kilictas.com/?p=415' data-counturl='http://samet.kilictas.com/if-exists-syntax-in-sybase/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/if-exists-syntax-in-sybase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A common error with GROUP BY Clause</title>
		<link>http://samet.kilictas.com/a-common-error-with-group-by-clause/</link>
		<comments>http://samet.kilictas.com/a-common-error-with-group-by-clause/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 12:46:40 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[clause]]></category>
		<category><![CDATA[common error]]></category>
		<category><![CDATA[db2]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[group by]]></category>
		<category><![CDATA[max]]></category>
		<category><![CDATA[min]]></category>
		<category><![CDATA[sybase]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=410</guid>
		<description><![CDATA[A common error with groups is to try to get information which cannot properly be put in a group. For example, SELECT sales_rep, emp_lname, count( * ) FROM sales_order KEY JOIN employee GROUP BY sales_rep gives the error column &#8216;emp_lname&#8217; cannot be used unless it is in a GROUP BY. SQL does not realize that [...]]]></description>
			<content:encoded><![CDATA[<p>A common error with groups is to try to get information which cannot properly be put in a group. For example,</p>
<pre class="brush: sql">

SELECT sales_rep, emp_lname, count( * )
FROM sales_order
KEY JOIN employee
GROUP BY sales_rep
</pre>
<p>gives the error</p>
<p>column &#8216;emp_lname&#8217; cannot be used unless it is in a GROUP BY.</p>
<p>SQL does not realize that each of the rows for an employee with a given ID have the same value of emp_lname. An error is reported since SQL does not know which of the names to display.</p>
<p>However, the following is valid:</p>
<pre class="brush: sql">

SELECT sales_rep, max( emp_lname ), count( * )
FROM sales_order
KEY JOIN employee
GROUP BY sales_rep
</pre>
<p>The max function chooses the maximum (last alphabetically) surname from the detail rows for each group. The surname is the same on every detail row within a group so the max is just a trick to bypass a limitation of SQL.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D410&count=vertical&related=&text=A%20common%20error%20with%20GROUP%20BY%20Clause' class='twitter-share-button' data-text='A common error with GROUP BY Clause' data-url='http://samet.kilictas.com/?p=410' data-counturl='http://samet.kilictas.com/a-common-error-with-group-by-clause/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/a-common-error-with-group-by-clause/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IBM RAD 7.5 on Ubuntu Karmic 32 Bit</title>
		<link>http://samet.kilictas.com/ibm-rad-7-5-on-ubuntu-karmic-32-bit/</link>
		<comments>http://samet.kilictas.com/ibm-rad-7-5-on-ubuntu-karmic-32-bit/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 17:08:32 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Karmic]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[RAD]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Websphere]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=396</guid>
		<description><![CDATA[Lets assume you were using ubuntu 9.04 jaunty and now you have upgraded your distribution to 9.10 karmic. Before i get into 9.10 version i had my RAD 7.5 installed and running. Then decided to upgrade my distro. I&#8217;ve read an article and futures of karmic distro, that says plenty of packages getting updated. After getting done [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-399 alignleft" title="IBM Rational Application Developer" src="http://samet.kilictas.com/wp-content/uploads/2009/12/rtl-mark-title-235x50.gif" alt="IBM Rational Application Developer" width="235" height="50" /><br />
Lets assume you were using ubuntu 9.04 jaunty and now you have upgraded your distribution to 9.10 karmic. Before i get into 9.10 version i had my RAD 7.5 installed and running. Then decided to upgrade my distro. I&#8217;ve read an article and futures of karmic distro, that says plenty of packages getting updated. After getting done with upgrade process i tried to run my RAD 7.5 , it was ok for the first time but there were plenty of errors on screen.</p>
<p>First of all when you upgrade your distro, the gcc++ package gets upgareded so libstdc++.so.5 file to libstdc++.so.6 .Unfortunately RAD 7.5 version looks for libstdc++.5.so file on your system. You have to download this file. Download it by using link below;</p>
<p><a title="http://packages.debian.org/stable/base/libstdc++5" href="http://packages.debian.org/stable/base/libstdc++5">http://packages.debian.org/stable/base/libstdc++5</a></p>
<p>Then install this deb package (If you are running on another linux distro you have to place it just next to where your libstdc++.6.so file, you can use &#8220;locate libstdc++.so.6&#8243; command to see where your file is). Then copy below bash script and paste it any of your text editor, save it as &#8220;run.sh&#8221;. From now on, you can use this script to run your RAD 7.5.</p>
<pre class="brush: bash">
#!/bin/bash
export GTK_NATIVE_WINDOWS=1
/where/your/RADis &amp;
</pre>
<p>After this process your problem should be gone. Have fun.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D396&count=vertical&related=&text=IBM%20RAD%207.5%20on%20Ubuntu%20Karmic%2032%20Bit' class='twitter-share-button' data-text='IBM RAD 7.5 on Ubuntu Karmic 32 Bit' data-url='http://samet.kilictas.com/?p=396' data-counturl='http://samet.kilictas.com/ibm-rad-7-5-on-ubuntu-karmic-32-bit/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/ibm-rad-7-5-on-ubuntu-karmic-32-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to enable TCP connections to XServer?</title>
		<link>http://samet.kilictas.com/how-to-enable-tcp-connections-to-xserver/</link>
		<comments>http://samet.kilictas.com/how-to-enable-tcp-connections-to-xserver/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 13:01:01 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Xserver]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=393</guid>
		<description><![CDATA[sudo gedit /etc/gdm/gdm.schemas find: &#60;schema&#62; &#60;key&#62;security/DisallowTCP&#60;/key&#62; &#60;signature&#62;b&#60;/signature&#62; &#60;default&#62;true&#60;/default&#62; &#60;/schema&#62; shift from true to false: &#60;schema&#62; &#60;key&#62;security/DisallowTCP&#60;/key&#62; &#60;signature&#62;b&#60;/signature&#62; &#60;default&#62;false&#60;/default&#62; &#60;/schema&#62; Tweet]]></description>
			<content:encoded><![CDATA[<hr style="color: #ffffff; background-color: #ffffff;" size="1" /><!-- / icon and title --> <!-- message --></p>
<div id="post_message_8227965"></div>
<div>sudo gedit /etc/gdm/gdm.schemas</div>
<div id="post_message_8227965">
<p>find:</p>
<p>&lt;schema&gt;<br />
&lt;key&gt;security/DisallowTCP&lt;/key&gt;<br />
&lt;signature&gt;b&lt;/signature&gt;<br />
&lt;default&gt;true&lt;/default&gt;<br />
&lt;/schema&gt;</p>
<p>shift from true to false:</p>
<p>&lt;schema&gt;<br />
&lt;key&gt;security/DisallowTCP&lt;/key&gt;<br />
&lt;signature&gt;b&lt;/signature&gt;<br />
&lt;default&gt;false&lt;/default&gt;<br />
&lt;/schema&gt;</p></div>
<a href='http://twitter.com/share?url=http%3A%2F%2Fsamet.kilictas.com%2F%3Fp%3D393&count=vertical&related=&text=How%20to%20enable%20TCP%20connections%20to%20XServer%3F' class='twitter-share-button' data-text='How to enable TCP connections to XServer?' data-url='http://samet.kilictas.com/?p=393' data-counturl='http://samet.kilictas.com/how-to-enable-tcp-connections-to-xserver/' data-count='vertical' data-via='sametkilictas'>Tweet</a>]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/how-to-enable-tcp-connections-to-xserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

